Skip to content

Commit

Permalink
Fix some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Apr 26, 2024
1 parent 71defde commit b477da7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions consensus/types/src/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,7 @@ impl<E: EthSpec> BeaconState<E> {
.map_err(Into::into)
}

/// Get active balance for the given `validator_index`.
pub fn get_active_balance(
&self,
validator_index: usize,
Expand All @@ -2102,7 +2103,6 @@ impl<E: EthSpec> BeaconState<E> {
.get(validator_index)
.map(|validator| validator.get_validator_max_effective_balance(spec))
.ok_or(Error::UnknownValidator(validator_index))?;
// TODO(pawan): this is assuming balances and validat
Ok(std::cmp::min(
*self
.balances()
Expand Down Expand Up @@ -2176,6 +2176,7 @@ impl<E: EthSpec> BeaconState<E> {
.map_err(Into::into)
}

/// Change the withdrawal prefix of the given `validator_index` to the compounding withdrawal validator prefix.
pub fn switch_to_compounding_validator(
&mut self,
validator_index: u64,
Expand All @@ -2188,10 +2189,9 @@ impl<E: EthSpec> BeaconState<E> {
if validator.has_eth1_withdrawal_credential(spec) {
validator.withdrawal_credentials =
spec.compounding_withdrawal_prefix_byte + validator.withdrawal_credentials[1..];
self.queue_excess_active_balance(validator_index, spec)
} else {
Ok(())
self.queue_excess_active_balance(validator_index, spec)?;
}
Ok(())
}

pub fn compute_exit_epoch_and_update_churn(
Expand Down

0 comments on commit b477da7

Please sign in to comment.