process withdrawals updates

This commit is contained in:
realbigsean
2024-05-06 18:56:16 -04:00
parent 2c2e44c4ed
commit e2e82ff1b9
8 changed files with 99 additions and 17 deletions

View File

@@ -4435,6 +4435,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let proposal_epoch = proposal_slot.epoch(T::EthSpec::slots_per_epoch());
if head_state.current_epoch() == proposal_epoch {
return get_expected_withdrawals(&unadvanced_state, &self.spec)
.map(|(withdrawals, _)| withdrawals)
.map_err(Error::PrepareProposerFailed);
}
@@ -4452,7 +4453,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
proposal_epoch.start_slot(T::EthSpec::slots_per_epoch()),
&self.spec,
)?;
get_expected_withdrawals(&advanced_state, &self.spec).map_err(Error::PrepareProposerFailed)
get_expected_withdrawals(&advanced_state, &self.spec)
.map(|(withdrawals, _)| withdrawals)
.map_err(Error::PrepareProposerFailed)
}
/// Determine whether a fork choice update to the execution layer should be overridden.

View File

@@ -413,7 +413,7 @@ pub fn get_execution_payload<T: BeaconChainTypes>(
state.latest_execution_payload_header()?.block_hash();
let withdrawals = match state {
&BeaconState::Capella(_) | &BeaconState::Deneb(_) | &BeaconState::Electra(_) => {
Some(get_expected_withdrawals(state, spec)?.into())
Some(get_expected_withdrawals(state, spec)?.0.into())
}
&BeaconState::Bellatrix(_) => None,
// These shouldn't happen but they're here to make the pattern irrefutable