mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-01 20:48:38 +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
|
// AssembleBlock finalizes the state and assembles the block with provided
|
||||||
// body and receipts.
|
// 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 {
|
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
|
var bal *bal.BlockAccessList
|
||||||
if chain.Config().IsAmsterdam(header.Number, header.Time) {
|
if chain.Config().IsAmsterdam(header.Number, header.Time) {
|
||||||
bal = blockAccessList.ToEncodingObj()
|
bal = blockAccessList.ToEncodingObj()
|
||||||
}
|
|
||||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
|
||||||
if bal != nil {
|
|
||||||
balHash := bal.Hash()
|
balHash := bal.Hash()
|
||||||
header.BlockAccessListHash = &balHash
|
header.BlockAccessListHash = &balHash
|
||||||
}
|
}
|
||||||
block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))
|
return types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)).WithAccessListUnsafe(bal)
|
||||||
if bal != nil {
|
|
||||||
block = block.WithAccessListUnsafe(bal)
|
|
||||||
}
|
|
||||||
return block
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue