mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 16:59:26 +00:00
core: rework AssembleBlock
This commit is contained in:
parent
54014e6560
commit
440449bf1e
1 changed files with 5 additions and 8 deletions
|
|
@ -413,18 +413,15 @@ func onSystemCallStart(tracer *tracing.Hooks, ctx *tracing.VMContext) {
|
|||
// AssembleBlock finalizes the state and assembles the block with provided
|
||||
// body and receipts.
|
||||
func AssembleBlock(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, blockAccessList *bal.ConstructionBlockAccessList) *types.Block {
|
||||
// Assign the post-transition state root
|
||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||
|
||||
// Assign the BlockAccessListHash if Amsterdam has been enabled
|
||||
var bal *bal.BlockAccessList
|
||||
if chain.Config().IsAmsterdam(header.Number, header.Time) {
|
||||
bal = blockAccessList.ToEncodingObj()
|
||||
}
|
||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||
if bal != nil {
|
||||
balHash := bal.Hash()
|
||||
header.BlockAccessListHash = &balHash
|
||||
}
|
||||
block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))
|
||||
if bal != nil {
|
||||
block = block.WithAccessListUnsafe(bal)
|
||||
}
|
||||
return block
|
||||
return types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)).WithAccessListUnsafe(bal)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue