Implement "Limit consolidating balance by validator.effective_balance"

This commit is contained in:
Michael Sproul
2024-12-20 16:23:14 +11:00
parent f27216f613
commit c31f1cceb1

View File

@@ -1057,14 +1057,12 @@ fn process_pending_consolidations<E: EthSpec>(
} }
// Calculate the consolidated balance // Calculate the consolidated balance
let max_effective_balance =
source_validator.get_max_effective_balance(spec, state_ctxt.fork_name);
let source_effective_balance = std::cmp::min( let source_effective_balance = std::cmp::min(
*state *state
.balances() .balances()
.get(source_index) .get(source_index)
.ok_or(BeaconStateError::UnknownValidator(source_index))?, .ok_or(BeaconStateError::UnknownValidator(source_index))?,
max_effective_balance, source_validator.effective_balance,
); );
// Move active balance to target. Excess balance is withdrawable. // Move active balance to target. Excess balance is withdrawable.