diff --git a/core/blockchain.go b/core/blockchain.go index 7bc283397b..34c82a7437 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -539,13 +539,12 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis rawdb.WriteChainConfig(db, genesisHash, chainConfig) } - if txLookupLimit == nil { + if txLookupLimit != nil { txLookupLimit = new(uint64) *txLookupLimit = txLookupCacheLimit + bc.txIndexer = newTxIndexer(*txLookupLimit, bc) } - bc.txIndexer = newTxIndexer(*txLookupLimit, bc) - return bc, nil } @@ -1569,7 +1568,7 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [ // generated. batch := bc.db.NewBatch() for i, block := range blockChain { - if bc.txIndexer.limit == 0 || ancientLimit <= bc.txIndexer.limit || block.NumberU64() >= ancientLimit-bc.txIndexer.limit { + if bc.txIndexer == nil || bc.txIndexer.limit == 0 || ancientLimit <= bc.txIndexer.limit || block.NumberU64() >= ancientLimit-bc.txIndexer.limit { rawdb.WriteTxLookupEntriesByBlock(batch, block) } else if rawdb.ReadTxIndexTail(bc.db) != nil { rawdb.WriteTxLookupEntriesByBlock(batch, block) diff --git a/core/blockchain_repair_test.go b/core/blockchain_repair_test.go index 84235aa9f9..f910e283bb 100644 --- a/core/blockchain_repair_test.go +++ b/core/blockchain_repair_test.go @@ -1801,7 +1801,6 @@ func testLongReorgedSnapSyncingDeepRepair(t *testing.T, snapshots bool) { } func testRepair(t *testing.T, tt *rewindTest, snapshots bool) { - t.Parallel() for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} { testRepairWithScheme(t, tt, snapshots, scheme) } diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index 29dd9ecba0..37273a09e5 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -531,7 +531,6 @@ func TestLowCommitCrashWithNewSnapshot(t *testing.T) { // Expected head block : C2 // Expected snapshot disk : C4 - t.Parallel() for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} { test := &crashSnapshotTest{ snapshotTestBasic{ @@ -575,7 +574,6 @@ func TestHighCommitCrashWithNewSnapshot(t *testing.T) { // Expected head block : G // Expected snapshot disk : C4 - t.Parallel() for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} { expHead := uint64(0) if scheme == rawdb.PathScheme {