mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
cleanup withdrawals processing
This commit is contained in:
@@ -547,7 +547,13 @@ pub fn get_expected_withdrawals<E: EthSpec>(
|
|||||||
withdrawals.push(Withdrawal {
|
withdrawals.push(Withdrawal {
|
||||||
index: withdrawal_index,
|
index: withdrawal_index,
|
||||||
validator_index: withdrawal.index,
|
validator_index: withdrawal.index,
|
||||||
address: Address::from_slice(&validator.withdrawal_credentials[12..]),
|
address: Address::from_slice(
|
||||||
|
validator
|
||||||
|
.withdrawal_credentials
|
||||||
|
.0
|
||||||
|
.get(12..)
|
||||||
|
.ok_or(BeaconStateError::IndexNotSupported(12))?,
|
||||||
|
),
|
||||||
amount: withdrawable_balance,
|
amount: withdrawable_balance,
|
||||||
});
|
});
|
||||||
withdrawal_index.safe_add_assign(1)?;
|
withdrawal_index.safe_add_assign(1)?;
|
||||||
@@ -634,12 +640,9 @@ pub fn process_withdrawals<E: EthSpec, Payload: AbstractExecPayload<E>>(
|
|||||||
if let Some(partial_withdrawals_count) = partial_withdrawals_count {
|
if let Some(partial_withdrawals_count) = partial_withdrawals_count {
|
||||||
let new_partial_withdrawals = state
|
let new_partial_withdrawals = state
|
||||||
.pending_partial_withdrawals()?
|
.pending_partial_withdrawals()?
|
||||||
.to_vec()
|
.iter_from(partial_withdrawals_count)?
|
||||||
.get(partial_withdrawals_count..)
|
.cloned()
|
||||||
.ok_or(BeaconStateError::PartialWithdrawalCountInvalid(
|
.collect::<Vec<_>>();
|
||||||
partial_withdrawals_count,
|
|
||||||
))?
|
|
||||||
.to_vec();
|
|
||||||
*state.pending_partial_withdrawals_mut()? = List::new(new_partial_withdrawals)?;
|
*state.pending_partial_withdrawals_mut()? = List::new(new_partial_withdrawals)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user