mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
consensus/bor: handle wrapped vm.State in Finalize
This commit is contained in:
parent
f9f84acd4b
commit
c0d0b1cb06
1 changed files with 8 additions and 3 deletions
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
|
@ -819,15 +820,19 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e
|
||||||
|
|
||||||
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block
|
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block
|
||||||
// rewards given.
|
// rewards given.
|
||||||
func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body) {
|
func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header, wrappedState vm.StateDB, body *types.Body) {
|
||||||
headerNumber := header.Number.Uint64()
|
headerNumber := header.Number.Uint64()
|
||||||
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if body.Requests != nil || header.RequestsHash != nil {
|
if header.RequestsHash != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract the underlying state to access methods like `IntermediateRoot` and `Copy`
|
||||||
|
// required for bor consensus operations
|
||||||
|
state := wrappedState.(*state.StateDB)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
stateSyncData []*types.StateSyncData
|
stateSyncData []*types.StateSyncData
|
||||||
err error
|
err error
|
||||||
|
|
@ -913,7 +918,7 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ
|
||||||
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
||||||
return nil, consensus.ErrUnexpectedWithdrawals
|
return nil, consensus.ErrUnexpectedWithdrawals
|
||||||
}
|
}
|
||||||
if body.Requests != nil || header.RequestsHash != nil {
|
if header.RequestsHash != nil {
|
||||||
return nil, consensus.ErrUnexpectedRequests
|
return nil, consensus.ErrUnexpectedRequests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue