mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Add progress on state_processing fixed-len update
This commit is contained in:
@@ -4,8 +4,8 @@ use types::{BeaconStateError as Error, *};
|
||||
/// Slash the validator with index ``index``.
|
||||
///
|
||||
/// Spec v0.5.1
|
||||
pub fn slash_validator(
|
||||
state: &mut BeaconState,
|
||||
pub fn slash_validator<T: BeaconStateTypes>(
|
||||
state: &mut BeaconState<T>,
|
||||
validator_index: usize,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
@@ -36,8 +36,7 @@ pub fn slash_validator(
|
||||
|
||||
state.set_slashed_balance(
|
||||
current_epoch,
|
||||
state.get_slashed_balance(current_epoch, spec)? + effective_balance,
|
||||
spec,
|
||||
state.get_slashed_balance(current_epoch)? + effective_balance,
|
||||
)?;
|
||||
|
||||
let whistleblower_index =
|
||||
@@ -56,7 +55,7 @@ pub fn slash_validator(
|
||||
state.validator_registry[validator_index].slashed = true;
|
||||
|
||||
state.validator_registry[validator_index].withdrawable_epoch =
|
||||
current_epoch + Epoch::from(spec.latest_slashed_exit_length);
|
||||
current_epoch + Epoch::from(T::LatestSlashedExitLength::to_usize());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user