mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
consensus, core, internal, miner: remove FinalizeAndAssemble
This commit is contained in:
parent
91e4122aa4
commit
afaa572600
3 changed files with 15 additions and 3 deletions
|
|
@ -416,7 +416,15 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
Uncles: b.uncles,
|
Uncles: b.uncles,
|
||||||
Withdrawals: b.withdrawals,
|
Withdrawals: b.withdrawals,
|
||||||
}
|
}
|
||||||
|
if !config.IsShanghai(b.header.Number, b.header.Time) {
|
||||||
|
if body.Withdrawals != nil {
|
||||||
|
panic("unexpected withdrawal before shanghai")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if body.Withdrawals == nil {
|
||||||
|
body.Withdrawals = make([]*types.Withdrawal, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
// Finalize the state transition by applying operations such as withdrawals,
|
// Finalize the state transition by applying operations such as withdrawals,
|
||||||
// uncle rewards, and related processing.
|
// uncle rewards, and related processing.
|
||||||
b.engine.Finalize(cm, b.header, statedb, &body)
|
b.engine.Finalize(cm, b.header, statedb, &body)
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
|
|
||||||
blockBody := &types.Body{
|
blockBody := &types.Body{
|
||||||
Transactions: txes,
|
Transactions: txes,
|
||||||
Withdrawals: *block.BlockOverrides.Withdrawals,
|
Withdrawals: *block.BlockOverrides.Withdrawals, // Withdrawal is also sanitized as non-nil
|
||||||
}
|
}
|
||||||
chainHeadReader := &simChainHeadReader{ctx, sim.b}
|
chainHeadReader := &simChainHeadReader{ctx, sim.b}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,11 @@ func (miner *Miner) generateWork(ctx context.Context, genParam *generateParams,
|
||||||
Transactions: work.txs,
|
Transactions: work.txs,
|
||||||
Withdrawals: genParam.withdrawals,
|
Withdrawals: genParam.withdrawals,
|
||||||
}
|
}
|
||||||
if miner.chainConfig.IsShanghai(work.header.Number, work.header.Time) {
|
if !miner.chainConfig.IsShanghai(work.header.Number, work.header.Time) {
|
||||||
|
if body.Withdrawals != nil {
|
||||||
|
return &newPayloadResult{err: errors.New("unexpected withdrawals before shanghai")}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if body.Withdrawals == nil {
|
if body.Withdrawals == nil {
|
||||||
body.Withdrawals = make([]*types.Withdrawal, 0)
|
body.Withdrawals = make([]*types.Withdrawal, 0)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue