mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
exit updates
This commit is contained in:
@@ -451,7 +451,10 @@ pub enum ExitInvalid {
|
||||
/// The specified validator has already initiated exit.
|
||||
AlreadyInitiatedExit(u64),
|
||||
/// The exit is for a future epoch.
|
||||
FutureEpoch { state: Epoch, exit: Epoch },
|
||||
FutureEpoch {
|
||||
state: Epoch,
|
||||
exit: Epoch,
|
||||
},
|
||||
/// The validator has not been active for long enough.
|
||||
TooYoungToExit {
|
||||
current_epoch: Epoch,
|
||||
@@ -462,6 +465,7 @@ pub enum ExitInvalid {
|
||||
/// There was an error whilst attempting to get a set of signatures. The signatures may have
|
||||
/// been invalid or an internal error occurred.
|
||||
SignatureSetError(SignatureSetError),
|
||||
PendingWithdrawalInQueue(u64),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
|
||||
@@ -79,5 +79,16 @@ pub fn verify_exit<E: EthSpec>(
|
||||
);
|
||||
}
|
||||
|
||||
// [New in Electra:EIP7251]
|
||||
// Only exit validator if it has no pending withdrawals in the queue
|
||||
if let Ok(pending_balance_to_withdraw) =
|
||||
state.get_pending_balance_to_withdraw(exit.validator_index as usize)
|
||||
{
|
||||
verify!(
|
||||
pending_balance_to_withdraw == 0,
|
||||
ExitInvalid::PendingWithdrawalInQueue(exit.validator_index)
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user