mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 15:46:43 +00:00
Add withdrawals to sanitizeChain
This commit is contained in:
parent
6d443ca1d2
commit
2209cb486a
1 changed files with 5 additions and 7 deletions
|
|
@ -319,13 +319,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
|||
reqHash := types.CalcRequestsHash(requests)
|
||||
header.RequestsHash = &reqHash
|
||||
}
|
||||
var withdrawals []*types.Withdrawal
|
||||
if block.BlockOverrides.Withdrawals != nil {
|
||||
withdrawals = *block.BlockOverrides.Withdrawals
|
||||
} else {
|
||||
withdrawals = []*types.Withdrawal{}
|
||||
}
|
||||
blockBody := &types.Body{Transactions: txes, Withdrawals: withdrawals}
|
||||
blockBody := &types.Body{Transactions: txes, Withdrawals: *block.BlockOverrides.Withdrawals}
|
||||
chainHeadReader := &simChainHeadReader{ctx, sim.b}
|
||||
b, err := sim.b.Engine().FinalizeAndAssemble(chainHeadReader, header, sim.state, blockBody, receipts)
|
||||
if err != nil {
|
||||
|
|
@ -392,6 +386,10 @@ func (sim *simulator) sanitizeChain(blocks []simBlock) ([]simBlock, error) {
|
|||
n := new(big.Int).Add(prevNumber, big.NewInt(1))
|
||||
block.BlockOverrides.Number = (*hexutil.Big)(n)
|
||||
}
|
||||
if block.BlockOverrides.Withdrawals == nil {
|
||||
var withdrawals types.Withdrawals
|
||||
block.BlockOverrides.Withdrawals = &withdrawals
|
||||
}
|
||||
diff := new(big.Int).Sub(block.BlockOverrides.Number.ToInt(), prevNumber)
|
||||
if diff.Cmp(common.Big0) <= 0 {
|
||||
return nil, &invalidBlockNumberError{fmt.Sprintf("block numbers must be in order: %d <= %d", block.BlockOverrides.Number.ToInt().Uint64(), prevNumber)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue