for i := 0; i < 10; i++ {
block := newBlock(uint64(i))
hash := block.Hash()
- if _, ok := cache.lruBlockHeaders.Get(hash); ok {
+ if b, _ := cache.getBlockHeader(&hash); b != nil {
t.Fatalf("find old block")
}
}
for i := 10; i < maxCachedBlockHeaders+10; i++ {
block := newBlock(uint64(i))
hash := block.Hash()
- if _, ok := cache.lruBlockHeaders.Get(hash); !ok {
+ if b, _ := cache.getBlockHeader(&hash); b == nil {
t.Fatalf("can't find new block")
}
}
for i := 0; i < 10; i++ {
voteResult := newVoteResult(uint64(i))
- if _, ok := cache.lruVoteResults.Get(voteResult.Seq); ok {
+ if v, _ := cache.getVoteResult(voteResult.Seq); v != nil {
t.Fatalf("find old vote result")
}
}
for i := 10; i < maxCachedVoteResults+10; i++ {
voteResult := newVoteResult(uint64(i))
- if _, ok := cache.lruVoteResults.Get(voteResult.Seq); !ok {
+ if v, _ := cache.getVoteResult(voteResult.Seq); v == nil {
t.Fatalf("can't find new vote result")
}
}