From 177074432db847c78081f61618f7e6e6ed390683 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Thu, 14 Mar 2024 08:58:51 -0400 Subject: [PATCH] Call `OnBlockchainInit` before `OnGenesisBlock` (#22) # Conflicts: # core/blockchain.go --- core/blockchain.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index cc88434e8f69..ee230123cdde 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -437,6 +437,10 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis } } + if bc.logger != nil && bc.logger.OnBlockchainInit != nil { + bc.logger.OnBlockchainInit(chainConfig) + } + if bc.logger != nil && bc.logger.OnGenesisBlock != nil { if block := bc.CurrentBlock(); block.Number.Uint64() == 0 { alloc, err := getGenesisState(bc.db, block.Hash()) @@ -488,10 +492,8 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis } rawdb.WriteChainConfig(db, genesisHash, chainConfig) } - if bc.logger != nil && bc.logger.OnBlockchainInit != nil { - bc.logger.OnBlockchainInit(chainConfig) - } - // Start tx indexer/unindexer if required. + + // Start tx indexer if it's enabled. if txLookupLimit != nil { bc.txLookupLimit = *txLookupLimit