mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 06:23:47 +00:00
Call OnBlockchainInit before OnGenesisBlock (#22)
This commit is contained in:
parent
cff9fba98f
commit
817e261fab
1 changed files with 5 additions and 3 deletions
|
|
@ -424,6 +424,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 bc.logger != nil && bc.logger.OnGenesisBlock != nil {
|
||||||
if block := bc.CurrentBlock(); block.Number.Uint64() == 0 {
|
if block := bc.CurrentBlock(); block.Number.Uint64() == 0 {
|
||||||
alloc, err := getGenesisState(bc.db, block.Hash())
|
alloc, err := getGenesisState(bc.db, block.Hash())
|
||||||
|
|
@ -470,9 +474,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
|
||||||
}
|
}
|
||||||
rawdb.WriteChainConfig(db, genesisHash, chainConfig)
|
rawdb.WriteChainConfig(db, genesisHash, chainConfig)
|
||||||
}
|
}
|
||||||
if bc.logger != nil && bc.logger.OnBlockchainInit != nil {
|
|
||||||
bc.logger.OnBlockchainInit(chainConfig)
|
|
||||||
}
|
|
||||||
// Start tx indexer if it's enabled.
|
// Start tx indexer if it's enabled.
|
||||||
if txLookupLimit != nil {
|
if txLookupLimit != nil {
|
||||||
bc.txIndexer = newTxIndexer(*txLookupLimit, bc)
|
bc.txIndexer = newTxIndexer(*txLookupLimit, bc)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue