mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
consensus/bor: remove state root calculation from bor consensus (#1539)
Remove call to `IntermediateRoot` in `Finalize` method of consensus while validating a remote block as it's not required and it updates a copy of header and not the actual header.
This commit is contained in:
parent
8d1e9d4745
commit
34db035d3f
2 changed files with 1 additions and 5 deletions
|
|
@ -878,10 +878,6 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// No block rewards in PoA, so the state remains as is and uncles are dropped
|
|
||||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
|
||||||
header.UncleHash = types.CalcUncleHash(nil)
|
|
||||||
|
|
||||||
// Set state sync data to blockchain
|
// Set state sync data to blockchain
|
||||||
bc := chain.(*core.BlockChain)
|
bc := chain.(*core.BlockChain)
|
||||||
bc.SetStateSync(stateSyncData)
|
bc.SetStateSync(stateSyncData)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ func TestGenesisContractChange(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, statedb.Database().TrieDB().Commit(root, true))
|
require.NoError(t, statedb.Database().TrieDB().Commit(root, true))
|
||||||
|
|
||||||
statedb, err := state.New(h.Root, state.NewDatabase(triedb.NewDatabase(db, triedb.HashDefaults), nil))
|
statedb, err := state.New(root, state.NewDatabase(triedb.NewDatabase(db, triedb.HashDefaults), nil))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
return root, statedb
|
return root, statedb
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue