Make add_validator_to_registry more in line with the spec

This commit is contained in:
Pawan Dhananjay
2024-10-29 12:27:15 -07:00
parent 061be34758
commit 37c765809a
4 changed files with 40 additions and 56 deletions

View File

@@ -470,7 +470,16 @@ pub fn apply_deposit<E: EthSpec>(
return Ok(());
}
state.add_validator_to_registry(&deposit_data, spec)?;
state.add_validator_to_registry(
deposit_data.pubkey,
deposit_data.withdrawal_credentials,
if state.fork_name_unchecked() >= ForkName::Electra {
0
} else {
amount
},
spec,
)?;
// [New in Electra:EIP7251]
if let Ok(pending_deposits) = state.pending_deposits_mut() {