diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 130e4727e5..c807d2b989 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -2164,7 +2164,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh if err != nil { Fatalf("%v", err) } - options := &core.BlockChainOptions{ + options := &core.BlockChainConfig{ TrieCleanLimit: ethconfig.Defaults.TrieCleanCache, NoPrefetch: ctx.Bool(CacheNoPrefetchFlag.Name), TrieDirtyLimit: ethconfig.Defaults.TrieDirtyCache, diff --git a/core/bench_test.go b/core/bench_test.go index f1ea698a8c..6e64f558ff 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -324,7 +324,7 @@ func benchReadChain(b *testing.B, full bool, count uint64) { genesis := &Genesis{Config: params.AllEthashProtocolChanges} makeChainForBench(db, genesis, full, count) db.Close() - options := *defaultOptions + options := *defaultConfig options.ArchiveMode = true b.ReportAllocs() diff --git a/core/block_validator_test.go b/core/block_validator_test.go index 7956468086..8df0aa4afb 100644 --- a/core/block_validator_test.go +++ b/core/block_validator_test.go @@ -49,7 +49,7 @@ func testHeaderVerification(t *testing.T, scheme string) { headers[i] = block.Header() } // Run the header checker for blocks one-by-one, checking for both valid and invalid nonces - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), options) defer chain.Stop() if err != nil { diff --git a/core/blockchain.go b/core/blockchain.go index 723bb56e90..0de1d57a7a 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -149,8 +149,8 @@ const ( BlockChainVersion uint64 = 9 ) -// BlockChainOptions contains the configuration fields for setting up blockchain. -type BlockChainOptions struct { +// BlockChainConfig contains the configuration of the BlockChain object. +type BlockChainConfig struct { // Trie database related options TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk @@ -187,7 +187,7 @@ type BlockChainOptions struct { } // triedbConfig derives the configures for trie database. -func (o *BlockChainOptions) triedbConfig(isVerkle bool) *triedb.Config { +func (o *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config { config := &triedb.Config{ Preimages: o.Preimages, IsVerkle: isVerkle, @@ -212,9 +212,9 @@ func (o *BlockChainOptions) triedbConfig(isVerkle bool) *triedb.Config { return config } -// defaultOptions are the default blockchain options if none are specified by the +// defaultConfig are the default blockchain options if none are specified by the // user (also used during testing). -var defaultOptions = &BlockChainOptions{ +var defaultConfig = &BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -224,10 +224,9 @@ var defaultOptions = &BlockChainOptions{ ChainHistoryMode: history.KeepAll, } -// BlockchainOptionsWithScheme returns a deep copied default chain config with -// a provided state scheme. -func BlockchainOptionsWithScheme(scheme string) *BlockChainOptions { - config := *defaultOptions +// DefaultBlockChainConfig returns the default config with a provided state scheme. +func DefaultBlockChainConfig(scheme string) *BlockChainConfig { + config := *defaultConfig config.StateScheme = scheme return &config } @@ -255,7 +254,7 @@ type txLookup struct { // canonical chain. type BlockChain struct { chainConfig *params.ChainConfig // Chain & network configuration - options *BlockChainOptions // Blockchain configuration + cfg *BlockChainConfig // Blockchain configuration db ethdb.Database // Low level persistent database to store final content in snaps *snapshot.Tree // Snapshot tree for fast trie leaf access @@ -311,22 +310,23 @@ type BlockChain struct { // NewBlockChain returns a fully initialised block chain using information // available in the database. It initialises the default Ethereum Validator // and Processor. -func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, options *BlockChainOptions) (*BlockChain, error) { - if options == nil { - options = defaultOptions +func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, cfg *BlockChainConfig) (*BlockChain, error) { + if cfg == nil { + cfg = DefaultBlockChainConfig(rawdb.HashScheme) } + // Open trie database with provided config enableVerkle, err := EnableVerkleAtGenesis(db, genesis) if err != nil { return nil, err } - triedb := triedb.NewDatabase(db, options.triedbConfig(enableVerkle)) + triedb := triedb.NewDatabase(db, cfg.triedbConfig(enableVerkle)) // Write the supplied genesis to the database if it has not been initialized // yet. The corresponding chain config will be returned, either from the // provided genesis or from the locally stored configuration if the genesis // has already been initialized. - chainConfig, genesisHash, compatErr, err := SetupGenesisBlockWithOverride(db, triedb, genesis, options.Overrides) + chainConfig, genesisHash, compatErr, err := SetupGenesisBlockWithOverride(db, triedb, genesis, cfg.Overrides) if err != nil { return nil, err } @@ -340,7 +340,7 @@ func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, bc := &BlockChain{ chainConfig: chainConfig, - options: options, + cfg: cfg, db: db, triedb: triedb, triegc: prque.New[int64, common.Hash](nil), @@ -352,13 +352,13 @@ func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, blockCache: lru.NewCache[common.Hash, *types.Block](blockCacheLimit), txLookupCache: lru.NewCache[common.Hash, txLookup](txLookupCacheLimit), engine: engine, - logger: options.VmConfig.Tracer, + logger: cfg.VmConfig.Tracer, } bc.hc, err = NewHeaderChain(db, chainConfig, engine, bc.insertStopped) if err != nil { return nil, err } - bc.flushInterval.Store(int64(options.TrieTimeLimit)) + bc.flushInterval.Store(int64(cfg.TrieTimeLimit)) bc.statedb = state.NewDatabase(bc.triedb, nil) bc.validator = NewBlockValidator(chainConfig, bc) bc.prefetcher = newStatePrefetcher(chainConfig, bc.hc) @@ -407,7 +407,7 @@ func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, // Note it's unnecessary in path mode which always keep trie data and // state data consistent. var diskRoot common.Hash - if bc.options.SnapshotLimit > 0 && bc.options.StateScheme == rawdb.HashScheme { + if bc.cfg.SnapshotLimit > 0 && bc.cfg.StateScheme == rawdb.HashScheme { diskRoot = rawdb.ReadSnapshotRoot(bc.db) } if diskRoot != (common.Hash{}) { @@ -494,8 +494,8 @@ func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, } // Start tx indexer if it's enabled. - if bc.options.TxLookupLimit != nil { - bc.txIndexer = newTxIndexer(*bc.options.TxLookupLimit, bc) + if bc.cfg.TxLookupLimit != nil { + bc.txIndexer = newTxIndexer(*bc.cfg.TxLookupLimit, bc) } return bc, nil } @@ -503,11 +503,11 @@ func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, func (bc *BlockChain) setupSnapshot() { // Short circuit if the chain is established with path scheme, as the // state snapshot has been integrated into path database natively. - if bc.options.StateScheme == rawdb.PathScheme { + if bc.cfg.StateScheme == rawdb.PathScheme { return } // Load any existing snapshot, regenerating it if loading failed - if bc.options.SnapshotLimit > 0 { + if bc.cfg.SnapshotLimit > 0 { // If the chain was rewound past the snapshot persistent layer (causing // a recovery block number to be persisted to disk), check if we're still // in recovery mode and in that case, don't invalidate the snapshot on a @@ -519,10 +519,10 @@ func (bc *BlockChain) setupSnapshot() { recover = true } snapconfig := snapshot.Config{ - CacheSize: bc.options.SnapshotLimit, + CacheSize: bc.cfg.SnapshotLimit, Recovery: recover, - NoBuild: bc.options.SnapshotNoBuild, - AsyncBuild: !bc.options.SnapshotWait, + NoBuild: bc.cfg.SnapshotNoBuild, + AsyncBuild: !bc.cfg.SnapshotWait, } bc.snaps, _ = snapshot.New(snapconfig, bc.db, bc.triedb, head.Root) @@ -646,7 +646,7 @@ func (bc *BlockChain) loadLastState() error { func (bc *BlockChain) initializeHistoryPruning(latest uint64) error { freezerTail, _ := bc.db.Tail() - switch bc.options.ChainHistoryMode { + switch bc.cfg.ChainHistoryMode { case history.KeepAll: if freezerTail == 0 { return nil @@ -667,7 +667,7 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error { // postmerge directly on an existing DB. We could just trigger the pruning // here, but it'd be a bit dangerous since they may not have intended this // action to happen. So just tell them how to do it. - log.Error(fmt.Sprintf("Chain history mode is configured as %q, but database is not pruned.", bc.options.ChainHistoryMode.String())) + log.Error(fmt.Sprintf("Chain history mode is configured as %q, but database is not pruned.", bc.cfg.ChainHistoryMode.String())) log.Error(fmt.Sprintf("Run 'geth prune-history' to prune pre-merge history.")) return fmt.Errorf("history pruning requested via configuration") } @@ -683,7 +683,7 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error { return nil default: - return fmt.Errorf("invalid history mode: %d", bc.options.ChainHistoryMode) + return fmt.Errorf("invalid history mode: %d", bc.cfg.ChainHistoryMode) } } @@ -1258,7 +1258,7 @@ func (bc *BlockChain) Stop() { // - HEAD: So we don't need to reprocess any blocks in the general case // - HEAD-1: So we don't do large reorgs if our HEAD becomes an uncle // - HEAD-127: So we have a hard limit on the number of blocks reexecuted - if !bc.options.ArchiveMode { + if !bc.cfg.ArchiveMode { triedb := bc.triedb for _, offset := range []uint64{0, 1, state.TriesInMemory - 1} { @@ -1564,7 +1564,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. return nil } // If we're running an archive node, always flush - if bc.options.ArchiveMode { + if bc.cfg.ArchiveMode { return bc.triedb.Commit(root, false) } // Full but not archive node, do proper garbage collection @@ -1579,7 +1579,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. // If we exceeded our memory allowance, flush matured singleton nodes to disk var ( _, nodes, imgs = bc.triedb.Size() // all memory is contained within the nodes return for hashdb - limit = common.StorageSize(bc.options.TrieDirtyLimit) * 1024 * 1024 + limit = common.StorageSize(bc.cfg.TrieDirtyLimit) * 1024 * 1024 ) if nodes > limit || imgs > 4*1024*1024 { bc.triedb.Cap(limit - ethdb.IdealBatchSize) @@ -1929,7 +1929,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s ) defer interrupt.Store(true) // terminate the prefetch at the end - if bc.options.NoPrefetch { + if bc.cfg.NoPrefetch { statedb, err = state.New(parentRoot, bc.statedb) if err != nil { return nil, err @@ -1954,7 +1954,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s } go func(start time.Time, throwaway *state.StateDB, block *types.Block) { // Disable tracing for prefetcher executions. - vmCfg := bc.options.VmConfig + vmCfg := bc.cfg.VmConfig vmCfg.Tracer = nil bc.prefetcher.Prefetch(block, throwaway, vmCfg, &interrupt) @@ -1973,7 +1973,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s // Generate witnesses either if we're self-testing, or if it's the // only block being inserted. A bit crude, but witnesses are huge, // so we refuse to make an entire chain of them. - if bc.options.VmConfig.StatelessSelfValidation || makeWitness { + if bc.cfg.VmConfig.StatelessSelfValidation || makeWitness { witness, err = stateless.NewWitness(block.Header(), bc) if err != nil { return nil, err @@ -1998,7 +1998,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s // Process block using the parent state as reference point pstart := time.Now() - res, err := bc.processor.Process(block, statedb, bc.options.VmConfig) + res, err := bc.processor.Process(block, statedb, bc.cfg.VmConfig) if err != nil { bc.reportBlock(block, res, err) return nil, err @@ -2018,7 +2018,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s // witness builder/runner, which would otherwise be impossible due to the // various invalid chain states/behaviors being contained in those tests. xvstart := time.Now() - if witness := statedb.Witness(); witness != nil && bc.options.VmConfig.StatelessSelfValidation { + if witness := statedb.Witness(); witness != nil && bc.cfg.VmConfig.StatelessSelfValidation { log.Warn("Running stateless self-validation", "block", block.Number(), "hash", block.Hash()) // Remove critical computed fields from the block to force true recalculation @@ -2029,7 +2029,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s task := types.NewBlockWithHeader(context).WithBody(*block.Body()) // Run the stateless self-cross-validation - crossStateRoot, crossReceiptRoot, err := ExecuteStateless(bc.chainConfig, bc.options.VmConfig, task, witness) + crossStateRoot, crossReceiptRoot, err := ExecuteStateless(bc.chainConfig, bc.cfg.VmConfig, task, witness) if err != nil { return nil, fmt.Errorf("stateless self-validation failed: %v", err) } diff --git a/core/blockchain_reader.go b/core/blockchain_reader.go index caeb117553..6a0cfd6704 100644 --- a/core/blockchain_reader.go +++ b/core/blockchain_reader.go @@ -408,7 +408,7 @@ func (bc *BlockChain) Genesis() *types.Block { // GetVMConfig returns the block chain VM config. func (bc *BlockChain) GetVMConfig() *vm.Config { - return &bc.options.VmConfig + return &bc.cfg.VmConfig } // TxIndexProgress returns the transaction indexing progress. diff --git a/core/blockchain_repair_test.go b/core/blockchain_repair_test.go index a0c8647973..0c243612fb 100644 --- a/core/blockchain_repair_test.go +++ b/core/blockchain_repair_test.go @@ -1781,7 +1781,7 @@ func testRepairWithScheme(t *testing.T, tt *rewindTest, snapshots bool, scheme s Config: params.AllEthashProtocolChanges, } engine = ethash.NewFullFaker() - option = &BlockChainOptions{ + option = &BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -1931,7 +1931,7 @@ func testIssue23496(t *testing.T, scheme string) { BaseFee: big.NewInt(params.InitialBaseFee), } engine = ethash.NewFullFaker() - options = BlockchainOptionsWithScheme(scheme) + options = DefaultBlockChainConfig(scheme) ) chain, err := NewBlockChain(db, gspec, engine, options) if err != nil { @@ -1985,7 +1985,7 @@ func testIssue23496(t *testing.T, scheme string) { } defer db.Close() - chain, err = NewBlockChain(db, gspec, engine, BlockchainOptionsWithScheme(scheme)) + chain, err = NewBlockChain(db, gspec, engine, DefaultBlockChainConfig(scheme)) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) } diff --git a/core/blockchain_sethead_test.go b/core/blockchain_sethead_test.go index d4872efc8c..0e35a7c849 100644 --- a/core/blockchain_sethead_test.go +++ b/core/blockchain_sethead_test.go @@ -1985,7 +1985,7 @@ func testSetHeadWithScheme(t *testing.T, tt *rewindTest, snapshots bool, scheme Config: params.AllEthashProtocolChanges, } engine = ethash.NewFullFaker() - options = &BlockChainOptions{ + options = &BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index 4ceb0c2079..f5bc28e9ae 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -81,7 +81,7 @@ func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Blo } engine = ethash.NewFullFaker() ) - chain, err := NewBlockChain(db, gspec, engine, BlockchainOptionsWithScheme(basic.scheme)) + chain, err := NewBlockChain(db, gspec, engine, DefaultBlockChainConfig(basic.scheme)) if err != nil { t.Fatalf("Failed to create chain: %v", err) } @@ -232,7 +232,7 @@ func (snaptest *snapshotTest) test(t *testing.T) { // Restart the chain normally chain.Stop() - newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, BlockchainOptionsWithScheme(snaptest.scheme)) + newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme)) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) } @@ -274,13 +274,13 @@ func (snaptest *crashSnapshotTest) test(t *testing.T) { // the crash, we do restart twice here: one after the crash and one // after the normal stop. It's used to ensure the broken snapshot // can be detected all the time. - newchain, err := NewBlockChain(newdb, snaptest.gspec, snaptest.engine, BlockchainOptionsWithScheme(snaptest.scheme)) + newchain, err := NewBlockChain(newdb, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme)) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) } newchain.Stop() - newchain, err = NewBlockChain(newdb, snaptest.gspec, snaptest.engine, BlockchainOptionsWithScheme(snaptest.scheme)) + newchain, err = NewBlockChain(newdb, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme)) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) } @@ -310,7 +310,7 @@ func (snaptest *gappedSnapshotTest) test(t *testing.T) { gappedBlocks, _ := GenerateChain(snaptest.gspec.Config, blocks[len(blocks)-1], snaptest.engine, snaptest.genDb, snaptest.gapped, func(i int, b *BlockGen) {}) // Insert a few more blocks without enabling snapshot - var options = &BlockChainOptions{ + var options = &BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -325,7 +325,7 @@ func (snaptest *gappedSnapshotTest) test(t *testing.T) { newchain.Stop() // Restart the chain with enabling the snapshot - options = BlockchainOptionsWithScheme(snaptest.scheme) + options = DefaultBlockChainConfig(snaptest.scheme) newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, options) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) @@ -354,7 +354,7 @@ func (snaptest *setHeadSnapshotTest) test(t *testing.T) { chain.SetHead(snaptest.setHead) chain.Stop() - newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, BlockchainOptionsWithScheme(snaptest.scheme)) + newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme)) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) } @@ -383,7 +383,7 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) { // and state committed. chain.Stop() - config := &BlockChainOptions{ + config := &BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -399,7 +399,7 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) { newchain.Stop() // Restart the chain, the wiper should start working - config = &BlockChainOptions{ + config = &BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -416,7 +416,7 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) { tmp.triedb.Close() tmp.stopWithoutSaving() - newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, BlockchainOptionsWithScheme(snaptest.scheme)) + newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme)) if err != nil { t.Fatalf("Failed to recreate chain: %v", err) } diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 11d081e7f5..4182b8f938 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -66,7 +66,7 @@ func newCanonical(engine consensus.Engine, n int, full bool, scheme string) (eth } ) // Initialize a fresh chain with only a genesis block - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, options) // Create and inject the requested chain @@ -724,7 +724,7 @@ func testFastVsFullChains(t *testing.T, scheme string) { }) // Import the chain as an archive node for the comparison baseline archiveDb := rawdb.NewMemoryDatabase() - archive, _ := NewBlockChain(archiveDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + archive, _ := NewBlockChain(archiveDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer archive.Stop() if n, err := archive.InsertChain(blocks); err != nil { @@ -732,7 +732,7 @@ func testFastVsFullChains(t *testing.T, scheme string) { } // Fast import the chain as a non-archive node to test fastDb := rawdb.NewMemoryDatabase() - fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer fast.Stop() if n, err := fast.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0); err != nil { @@ -745,7 +745,7 @@ func testFastVsFullChains(t *testing.T, scheme string) { } defer ancientDb.Close() - ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer ancient.Stop() if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(len(blocks)/2)); err != nil { @@ -852,7 +852,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) { archiveDb := makeDb() defer archiveDb.Close() - options := *defaultOptions + options := *defaultConfig options.ArchiveMode = true options.StateScheme = scheme @@ -869,7 +869,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) { // Import the chain as a non-archive node and ensure all pointers are updated fastDb := makeDb() defer fastDb.Close() - fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer fast.Stop() if n, err := fast.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0); err != nil { @@ -882,7 +882,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) { // Import the chain as a ancient-first node and ensure all pointers are updated ancientDb := makeDb() defer ancientDb.Close() - ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer ancient.Stop() if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(3*len(blocks)/4)); err != nil { @@ -903,7 +903,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) { for i, block := range blocks { headers[i] = block.Header() } - light, _ := NewBlockChain(lightDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + light, _ := NewBlockChain(lightDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) if n, err := light.InsertHeaderChain(headers); err != nil { t.Fatalf("failed to insert header %d: %v", n, err) } @@ -976,7 +976,7 @@ func testChainTxReorgs(t *testing.T, scheme string) { }) // Import the chain. This runs all block validation rules. db := rawdb.NewMemoryDatabase() - blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) if i, err := blockchain.InsertChain(chain); err != nil { t.Fatalf("failed to insert original chain[%d]: %v", i, err) } @@ -1050,7 +1050,7 @@ func testLogReorgs(t *testing.T, scheme string) { signer = types.LatestSigner(gspec.Config) ) - blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer blockchain.Stop() rmLogsCh := make(chan RemovedLogsEvent) @@ -1106,7 +1106,7 @@ func testLogRebirth(t *testing.T, scheme string) { gspec = &Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{addr1: {Balance: big.NewInt(10000000000000000)}}} signer = types.LatestSigner(gspec.Config) engine = ethash.NewFaker() - blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, BlockchainOptionsWithScheme(scheme)) + blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, DefaultBlockChainConfig(scheme)) ) defer blockchain.Stop() @@ -1187,7 +1187,7 @@ func testSideLogRebirth(t *testing.T, scheme string) { addr1 = crypto.PubkeyToAddress(key1.PublicKey) gspec = &Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{addr1: {Balance: big.NewInt(10000000000000000)}}} signer = types.LatestSigner(gspec.Config) - blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) ) defer blockchain.Stop() @@ -1386,7 +1386,7 @@ func testEIP155Transition(t *testing.T, scheme string) { } }) - blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer blockchain.Stop() if _, err := blockchain.InsertChain(blocks); err != nil { @@ -1479,7 +1479,7 @@ func testEIP161AccountRemoval(t *testing.T, scheme string) { block.AddTx(tx) }) // account must exist pre eip 161 - blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer blockchain.Stop() if _, err := blockchain.InsertChain(types.Blocks{blocks[0]}); err != nil { @@ -1537,7 +1537,7 @@ func testBlockchainHeaderchainReorgConsistency(t *testing.T, scheme string) { } // Import the canonical and fork chain side by side, verifying the current block // and current header consistency - chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, BlockchainOptionsWithScheme(scheme)) + chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, DefaultBlockChainConfig(scheme)) if err != nil { t.Fatalf("failed to create tester chain: %v", err) } @@ -1627,7 +1627,7 @@ func testLargeReorgTrieGC(t *testing.T, scheme string) { db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false) defer db.Close() - chain, err := NewBlockChain(db, genesis, engine, BlockchainOptionsWithScheme(scheme)) + chain, err := NewBlockChain(db, genesis, engine, DefaultBlockChainConfig(scheme)) if err != nil { t.Fatalf("failed to create tester chain: %v", err) } @@ -1695,7 +1695,7 @@ func testBlockchainRecovery(t *testing.T, scheme string) { t.Fatalf("failed to create temp freezer db: %v", err) } defer ancientDb.Close() - ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(3*len(blocks)/4)); err != nil { t.Fatalf("failed to insert receipt %d: %v", n, err) @@ -1708,7 +1708,7 @@ func testBlockchainRecovery(t *testing.T, scheme string) { rawdb.WriteHeadFastBlockHash(ancientDb, midBlock.Hash()) // Reopen broken blockchain again - ancient, _ = NewBlockChain(ancientDb, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(scheme)) + ancient, _ = NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme)) defer ancient.Stop() if num := ancient.CurrentBlock().Number.Uint64(); num != 0 { t.Errorf("head block mismatch: have #%v, want #%v", num, 0) @@ -1751,7 +1751,7 @@ func testLowDiffLongChain(t *testing.T, scheme string) { diskdb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false) defer diskdb.Close() - chain, err := NewBlockChain(diskdb, genesis, engine, BlockchainOptionsWithScheme(scheme)) + chain, err := NewBlockChain(diskdb, genesis, engine, DefaultBlockChainConfig(scheme)) if err != nil { t.Fatalf("failed to create tester chain: %v", err) } @@ -1966,7 +1966,7 @@ func testInsertKnownChainData(t *testing.T, typ string, scheme string) { } defer chaindb.Close() - chain, err := NewBlockChain(chaindb, genesis, engine, BlockchainOptionsWithScheme(scheme)) + chain, err := NewBlockChain(chaindb, genesis, engine, DefaultBlockChainConfig(scheme)) if err != nil { t.Fatalf("failed to create tester chain: %v", err) } @@ -2235,7 +2235,7 @@ func getLongAndShortChains(scheme string) (*BlockChain, []*types.Block, []*types genDb, longChain, _ := GenerateChainWithGenesis(genesis, engine, 80, func(i int, b *BlockGen) { b.SetCoinbase(common.Address{1}) }) - chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, BlockchainOptionsWithScheme(scheme)) + chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, DefaultBlockChainConfig(scheme)) if err != nil { return nil, nil, nil, nil, fmt.Errorf("failed to create tester chain: %v", err) } @@ -2503,7 +2503,7 @@ func testSideImportPrunedBlocks(t *testing.T, scheme string) { } defer db.Close() - chain, err := NewBlockChain(db, genesis, engine, BlockchainOptionsWithScheme(scheme)) + chain, err := NewBlockChain(db, genesis, engine, DefaultBlockChainConfig(scheme)) if err != nil { t.Fatalf("failed to create tester chain: %v", err) } @@ -2602,7 +2602,7 @@ func testDeleteCreateRevert(t *testing.T, scheme string) { b.AddTx(tx) }) // Import the canonical chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options) if err != nil { t.Fatalf("failed to create tester chain: %v", err) @@ -2716,7 +2716,7 @@ func testDeleteRecreateSlots(t *testing.T, scheme string) { b.AddTx(tx) }) // Import the canonical chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) options.VmConfig = vm.Config{ Tracer: logger.NewJSONLogger(nil, os.Stdout), } @@ -2800,7 +2800,7 @@ func testDeleteRecreateAccount(t *testing.T, scheme string) { b.AddTx(tx) }) // Import the canonical chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) options.VmConfig = vm.Config{ Tracer: logger.NewJSONLogger(nil, os.Stdout), } @@ -2977,7 +2977,7 @@ func testDeleteRecreateSlotsAcrossManyBlocks(t *testing.T, scheme string) { current = exp }) // Import the canonical chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) options.VmConfig = vm.Config{ //Debug: true, //Tracer: vm.NewJSONLogger(nil, os.Stdout), @@ -3117,7 +3117,7 @@ func testInitThenFailCreateContract(t *testing.T, scheme string) { }) // Import the canonical chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) options.VmConfig = vm.Config{ //Debug: true, //Tracer: vm.NewJSONLogger(nil, os.Stdout), @@ -3209,7 +3209,7 @@ func testEIP2718Transition(t *testing.T, scheme string) { }) // Import the canonical chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options) if err != nil { t.Fatalf("failed to create tester chain: %v", err) @@ -3304,7 +3304,7 @@ func testEIP1559Transition(t *testing.T, scheme string) { b.AddTx(tx) }) - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options) if err != nil { t.Fatalf("failed to create tester chain: %v", err) @@ -3418,7 +3418,7 @@ func testSetCanonical(t *testing.T, scheme string) { diskdb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false) defer diskdb.Close() - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) chain, err := NewBlockChain(diskdb, gspec, engine, options) if err != nil { t.Fatalf("failed to create tester chain: %v", err) @@ -3528,7 +3528,7 @@ func testCanonicalHashMarker(t *testing.T, scheme string) { _, forkB, _ := GenerateChainWithGenesis(gspec, engine, c.forkB, func(i int, gen *BlockGen) {}) // Initialize test chain - options := BlockchainOptionsWithScheme(scheme) + options := DefaultBlockChainConfig(scheme) chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options) if err != nil { t.Fatalf("failed to create tester chain: %v", err) @@ -3860,7 +3860,7 @@ func TestTransientStorageReset(t *testing.T) { }) // Initialize the blockchain with 1153 enabled. - options := *defaultOptions + options := *defaultConfig options.VmConfig = vmConfig chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, &options) if err != nil { @@ -3956,7 +3956,7 @@ func TestEIP3651(t *testing.T) { b.AddTx(tx) }) - options := *defaultOptions + options := *defaultConfig options.VmConfig = vm.Config{ Tracer: logger.NewMarkdownLogger(&logger.Config{}, os.Stderr).Hooks(), } @@ -4219,7 +4219,7 @@ func testChainReorgSnapSync(t *testing.T, ancientLimit uint64) { db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false) defer db.Close() - options := BlockchainOptionsWithScheme(rawdb.PathScheme) + options := DefaultBlockChainConfig(rawdb.PathScheme) chain, _ := NewBlockChain(db, gspec, beacon.New(ethash.NewFaker()), options) defer chain.Stop() @@ -4330,13 +4330,13 @@ func testInsertChainWithCutoff(t *testing.T, cutoff uint64, ancientLimit uint64, }() // Enable pruning in cache config. - config := BlockchainOptionsWithScheme(rawdb.PathScheme) + config := DefaultBlockChainConfig(rawdb.PathScheme) config.ChainHistoryMode = history.KeepPostMerge db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false) defer db.Close() - options := BlockchainOptionsWithScheme(rawdb.PathScheme) + options := DefaultBlockChainConfig(rawdb.PathScheme) chain, _ := NewBlockChain(db, genesis, beacon.New(ethash.NewFaker()), options) defer chain.Stop() diff --git a/core/chain_makers.go b/core/chain_makers.go index 4f301912ce..8e432aa78a 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -579,7 +579,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine func GenerateVerkleChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, gen func(int, *BlockGen)) (common.Hash, ethdb.Database, []*types.Block, []types.Receipts, []*verkle.VerkleProof, []verkle.StateDiff) { db := rawdb.NewMemoryDatabase() - cacheConfig := BlockchainOptionsWithScheme(rawdb.PathScheme) + cacheConfig := DefaultBlockChainConfig(rawdb.PathScheme) cacheConfig.SnapshotLimit = 0 triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true)) defer triedb.Close() diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go index 957b3b3180..f18b2df010 100644 --- a/core/chain_makers_test.go +++ b/core/chain_makers_test.go @@ -233,7 +233,7 @@ func ExampleGenerateChain() { }) // Import the chain. This runs all block validation rules. - blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), BlockchainOptionsWithScheme(rawdb.HashScheme)) + blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), DefaultBlockChainConfig(rawdb.HashScheme)) defer blockchain.Stop() if i, err := blockchain.InsertChain(chain); err != nil { diff --git a/core/genesis_test.go b/core/genesis_test.go index 83e29e8caa..99e4962e63 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -130,7 +130,7 @@ func testSetupGenesis(t *testing.T, scheme string) { tdb := triedb.NewDatabase(db, newDbConfig(scheme)) oldcustomg.Commit(db, tdb) - bc, _ := NewBlockChain(db, &oldcustomg, ethash.NewFullFaker(), BlockchainOptionsWithScheme(scheme)) + bc, _ := NewBlockChain(db, &oldcustomg, ethash.NewFullFaker(), DefaultBlockChainConfig(scheme)) defer bc.Stop() _, blocks, _ := GenerateChainWithGenesis(&oldcustomg, ethash.NewFaker(), 4, nil) diff --git a/core/verkle_witness_test.go b/core/verkle_witness_test.go index cdbb6ae240..ce9cd1c285 100644 --- a/core/verkle_witness_test.go +++ b/core/verkle_witness_test.go @@ -119,7 +119,7 @@ func TestProcessVerkle(t *testing.T) { // Verkle trees use the snapshot, which must be enabled before the // data is saved into the tree+database. // genesis := gspec.MustCommit(bcdb, triedb) - options := BlockchainOptionsWithScheme(rawdb.PathScheme) + options := DefaultBlockChainConfig(rawdb.PathScheme) options.SnapshotLimit = 0 blockchain, _ := NewBlockChain(bcdb, gspec, beacon.New(ethash.NewFaker()), options) defer blockchain.Stop() @@ -255,7 +255,7 @@ func TestProcessParentBlockHash(t *testing.T) { }) t.Run("Verkle", func(t *testing.T) { db := rawdb.NewMemoryDatabase() - cacheConfig := BlockchainOptionsWithScheme(rawdb.PathScheme) + cacheConfig := DefaultBlockChainConfig(rawdb.PathScheme) cacheConfig.SnapshotLimit = 0 triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true)) statedb, _ := state.New(types.EmptyVerkleHash, state.NewDatabase(triedb, nil)) diff --git a/eth/api_debug_test.go b/eth/api_debug_test.go index a7ded703b9..034026b366 100644 --- a/eth/api_debug_test.go +++ b/eth/api_debug_test.go @@ -67,7 +67,7 @@ func newTestBlockChain(t *testing.T, n int, gspec *core.Genesis, generator func( _, blocks, _ := core.GenerateChainWithGenesis(gspec, engine, n, generator) // Import the canonical chain - options := &core.BlockChainOptions{ + options := &core.BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/eth/backend.go b/eth/backend.go index 1ccd47e829..cd45ba4ed7 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -194,7 +194,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { vmConfig = vm.Config{ EnablePreimageRecording: config.EnablePreimageRecording, } - options = &core.BlockChainOptions{ + options = &core.BlockChainConfig{ TrieCleanLimit: config.TrieCleanCache, NoPrefetch: config.NoPrefetch, TrieDirtyLimit: config.TrieDirtyCache, diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go index 8dc2cded20..307a85a287 100644 --- a/eth/filters/filter_test.go +++ b/eth/filters/filter_test.go @@ -277,7 +277,7 @@ func testFilters(t *testing.T, history uint64, noHistory bool) { } }) var l uint64 - options := core.BlockchainOptionsWithScheme(rawdb.HashScheme) + options := core.DefaultBlockChainConfig(rawdb.HashScheme) options.TxLookupLimit = &l bc, err := core.NewBlockChain(db, gspec, ethash.NewFaker(), options) if err != nil { @@ -437,7 +437,7 @@ func TestRangeLogs(t *testing.T) { chain, _ := core.GenerateChain(gspec.Config, gspec.ToBlock(), ethash.NewFaker(), db, 1000, func(i int, gen *core.BlockGen) {}) var l uint64 - options := core.BlockchainOptionsWithScheme(rawdb.HashScheme) + options := core.DefaultBlockChainConfig(rawdb.HashScheme) options.TxLookupLimit = &l bc, err := core.NewBlockChain(db, gspec, ethash.NewFaker(), options) if err != nil { diff --git a/eth/gasprice/gasprice_test.go b/eth/gasprice/gasprice_test.go index 7dd72ff24a..02a25bc4d8 100644 --- a/eth/gasprice/gasprice_test.go +++ b/eth/gasprice/gasprice_test.go @@ -211,7 +211,7 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, cancunBlock *big.Int, pe }) // Construct testing chain - chain, err := core.NewBlockChain(db, gspec, engine, &core.BlockChainOptions{NoPrefetch: true}) + chain, err := core.NewBlockChain(db, gspec, engine, &core.BlockChainConfig{NoPrefetch: true}) if err != nil { t.Fatalf("Failed to create local chain, %v", err) } diff --git a/eth/protocols/snap/handler_fuzzing_test.go b/eth/protocols/snap/handler_fuzzing_test.go index af521c3526..4930ae9ae6 100644 --- a/eth/protocols/snap/handler_fuzzing_test.go +++ b/eth/protocols/snap/handler_fuzzing_test.go @@ -116,7 +116,7 @@ func getChain() *core.BlockChain { Alloc: ga, } _, blocks, _ := core.GenerateChainWithGenesis(gspec, ethash.NewFaker(), 2, func(i int, gen *core.BlockGen) {}) - options := &core.BlockChainOptions{ + options := &core.BlockChainConfig{ TrieCleanLimit: 0, TrieDirtyLimit: 0, TrieTimeLimit: 5 * time.Minute, diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index 90bdcd645d..1826c78582 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -77,7 +77,7 @@ func newTestBackend(t *testing.T, n int, gspec *core.Genesis, generator func(i i _, blocks, _ := core.GenerateChainWithGenesis(gspec, backend.engine, n, generator) // Import the canonical chain - options := &core.BlockChainOptions{ + options := &core.BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -1144,7 +1144,7 @@ func newTestMergedBackend(t *testing.T, n int, gspec *core.Genesis, generator fu _, blocks, _ := core.GenerateChainWithGenesis(gspec, backend.engine, n, generator) // Import the canonical chain - options := &core.BlockChainOptions{ + options := &core.BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/eth/tracers/internal/tracetest/supply_test.go b/eth/tracers/internal/tracetest/supply_test.go index 36292bd59e..a06e123f01 100644 --- a/eth/tracers/internal/tracetest/supply_test.go +++ b/eth/tracers/internal/tracetest/supply_test.go @@ -554,7 +554,7 @@ func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockG return nil, nil, fmt.Errorf("failed to create call tracer: %v", err) } - options := core.BlockchainOptionsWithScheme(rawdb.PathScheme) + options := core.DefaultBlockChainConfig(rawdb.PathScheme) options.VmConfig = vm.Config{Tracer: tracer} chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, options) if err != nil { diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 81ebe6b05e..0b6d19e00f 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -444,7 +444,7 @@ type testBackend struct { func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.Engine, generator func(i int, b *core.BlockGen)) *testBackend { var ( txLookupLimit = uint64(0) - options = &core.BlockChainOptions{ + options = &core.BlockChainConfig{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/miner/payload_building_test.go b/miner/payload_building_test.go index 8749839674..295962d7ef 100644 --- a/miner/payload_building_test.go +++ b/miner/payload_building_test.go @@ -117,7 +117,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine default: t.Fatalf("unexpected consensus engine type: %T", engine) } - chain, err := core.NewBlockChain(db, gspec, engine, &core.BlockChainOptions{ArchiveMode: true}) + chain, err := core.NewBlockChain(db, gspec, engine, &core.BlockChainConfig{ArchiveMode: true}) if err != nil { t.Fatalf("core.NewBlockChain failed: %v", err) } diff --git a/tests/block_test_util.go b/tests/block_test_util.go index ee5b4ba3df..6a96477614 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -151,7 +151,7 @@ func (t *BlockTest) Run(snapshotter bool, scheme string, witness bool, tracer *t // Wrap the original engine within the beacon-engine engine := beacon.New(ethash.NewFaker()) - options := &core.BlockChainOptions{ + options := &core.BlockChainConfig{ TrieCleanLimit: 0, StateScheme: scheme, Preimages: true,