refactor: simplify withdrawals outcome (#12780)

This commit is contained in:
Hai | RISE
2024-11-22 21:15:43 +07:00
committed by GitHub
parent 87ecb43413
commit 64728e0856
3 changed files with 23 additions and 56 deletions

View File

@ -14,7 +14,7 @@ use alloy_eips::{eip4844::MAX_DATA_GAS_PER_BLOCK, eip7685::Requests, merge::BEAC
use alloy_primitives::U256;
use reth_basic_payload_builder::{
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
PayloadConfig, WithdrawalsOutcome,
PayloadConfig,
};
use reth_chain_state::ExecutedBlock;
use reth_chainspec::ChainSpec;
@ -356,8 +356,8 @@ where
None
};
let WithdrawalsOutcome { withdrawals_root, withdrawals } =
commit_withdrawals(&mut db, &chain_spec, attributes.timestamp, attributes.withdrawals)?;
let withdrawals_root =
commit_withdrawals(&mut db, &chain_spec, attributes.timestamp, &attributes.withdrawals)?;
// merge all transitions into bundle state, this would apply the withdrawal balance changes
// and 4788 contract call
@ -443,7 +443,11 @@ where
// seal the block
let block = Block {
header,
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals },
body: BlockBody {
transactions: executed_txs,
ommers: vec![],
withdrawals: Some(attributes.withdrawals.clone()),
},
};
let sealed_block = Arc::new(block.seal_slow());