state_processing: process_slashings v0.6.1

This commit is contained in:
Michael Sproul 2019-05-14 12:56:15 +10:00
parent e80264b8c8
commit 894ecdd4ea
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914

View File

@ -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);
}
}