mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
offences: make fn slash_fraction non-static (#11956)
* offences: make fn slash_fraction non-static * Bastifmt (inline variable)
This commit is contained in:
@@ -120,7 +120,6 @@ where
|
||||
fn report_offence(reporters: Vec<T::AccountId>, offence: O) -> Result<(), OffenceError> {
|
||||
let offenders = offence.offenders();
|
||||
let time_slot = offence.time_slot();
|
||||
let validator_set_count = offence.validator_set_count();
|
||||
|
||||
// Go through all offenders in the offence report and find all offenders that were spotted
|
||||
// in unique reports.
|
||||
@@ -134,7 +133,7 @@ where
|
||||
let offenders_count = concurrent_offenders.len() as u32;
|
||||
|
||||
// The amount new offenders are slashed
|
||||
let new_fraction = O::slash_fraction(offenders_count, validator_set_count);
|
||||
let new_fraction = offence.slash_fraction(offenders_count);
|
||||
|
||||
let slash_perbill: Vec<_> = (0..concurrent_offenders.len()).map(|_| new_fraction).collect();
|
||||
|
||||
|
||||
@@ -168,8 +168,8 @@ impl<T: Clone> offence::Offence<T> for Offence<T> {
|
||||
1
|
||||
}
|
||||
|
||||
fn slash_fraction(offenders_count: u32, validator_set_count: u32) -> Perbill {
|
||||
Perbill::from_percent(5 + offenders_count * 100 / validator_set_count)
|
||||
fn slash_fraction(&self, offenders_count: u32) -> Perbill {
|
||||
Perbill::from_percent(5 + offenders_count * 100 / self.validator_set_count)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user