+ t.Fatalf("can't find new block header")
+ }
+ }
+
+ for i := 0; i < maxCachedBlockTransactions+10; i++ {
+ block := newBlock(uint64(i))
+ hash := block.Hash()
+ cache.lookupBlockTxs(&hash)
+ }
+
+ for i := 0; i < 10; i++ {
+ block := newBlock(uint64(i))
+ hash := block.Hash()
+ if _, ok := cache.lruBlockTxs.Get(hash); ok {
+ t.Fatalf("find old block transactions")
+ }
+ }
+
+ for i := 10; i < maxCachedBlockTransactions+10; i++ {
+ block := newBlock(uint64(i))
+ hash := block.Hash()
+ if _, ok := cache.lruBlockTxs.Get(hash); !ok {
+ t.Fatalf("can't find new block transactions")
+ }
+ }
+
+ for i := 0; i < maxCachedBlockHashes+10; i++ {
+ block := newBlock(uint64(i))
+ cache.lookupBlockHashesByHeight(block.Height)
+ }
+
+ for i := 0; i < 10; i++ {
+ block := newBlock(uint64(i))
+ if _, ok := cache.lruBlockHashes.Get(block.Height); ok {
+ t.Fatalf("find old block Hashes for specified height")
+ }
+ }
+
+ for i := 10; i < maxCachedBlockHashes+10; i++ {
+ block := newBlock(uint64(i))
+ if _, ok := cache.lruBlockHashes.Get(block.Height); !ok {
+ t.Fatalf("can't find new block Hashes for specified height")
+ }
+ }
+
+ for i := 0; i < maxCachedMainChainHashes+10; i++ {
+ block := newBlock(uint64(i))
+ cache.lookupMainChainHash(block.Height)
+ }
+
+ for i := 0; i < 10; i++ {
+ block := newBlock(uint64(i))
+ if _, ok := cache.lruMainChainHashes.Get(block.Height); ok {
+ t.Fatalf("find old main chain block Hash for specified height")
+ }
+ }
+
+ for i := 10; i < maxCachedMainChainHashes+10; i++ {
+ block := newBlock(uint64(i))
+ if _, ok := cache.lruMainChainHashes.Get(block.Height); !ok {
+ t.Fatalf("can't find new main chain block Hash for specified height")