state_processing: process_slashings v0.6.1
@@ -2,7 +2,7 @@ use types::{BeaconStateError as Error, *};
/// Process slashings.
///
-/// Spec v0.5.1
+/// Spec v0.6.1
pub fn process_slashings<T: EthSpec>(
state: &mut BeaconState<T>,
current_total_balance: u64,
@@ -24,10 +24,10 @@ pub fn process_slashings<T: EthSpec>(
let penalty = std::cmp::max(
effective_balance * std::cmp::min(total_penalities * 3, current_total_balance)
/ current_total_balance,
- effective_balance / 1, /* FIXME(sproul): spec.min_penalty_quotient, */
+ effective_balance / spec.min_slashing_penalty_quotient,
);
- state.balances[index] -= penalty;
+ safe_sub_assign!(state.balances[index], penalty);
}
}
