mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core: remove weird conditional around consensus engine
GenerateChain doesn't work without a consensus engine, so this check is redundant and weird.
This commit is contained in:
parent
04f173ed72
commit
9783cbb995
1 changed files with 16 additions and 15 deletions
|
|
@ -306,6 +306,9 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
|||
if config == nil {
|
||||
config = params.TestChainConfig
|
||||
}
|
||||
if engine == nil {
|
||||
panic("nil consensus engine")
|
||||
}
|
||||
cm := newChainMaker(parent, config)
|
||||
|
||||
genblock := func(i int, parent *types.Block, triedb *trie.Database, statedb *state.StateDB) (*types.Block, types.Receipts) {
|
||||
|
|
@ -340,7 +343,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
|||
if gen != nil {
|
||||
gen(i, b)
|
||||
}
|
||||
if b.engine != nil {
|
||||
|
||||
block, err := b.engine.FinalizeAndAssemble(cm, b.header, statedb, b.txs, b.uncles, b.receipts, b.withdrawals)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
@ -356,8 +359,6 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
|||
}
|
||||
return block, b.receipts
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Forcibly use hash-based state scheme for retaining all nodes in disk.
|
||||
triedb := trie.NewDatabase(db, trie.HashDefaults)
|
||||
|
|
|
|||
Loading…
Reference in a new issue