mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-16 17:07:35 +00:00
try_from -> from
This commit is contained in:
parent
df8b455d54
commit
205bec36e5
1 changed files with 2 additions and 4 deletions
|
@ -99,11 +99,9 @@ pub fn set_keys_message(set: &ValidatorSet, key_pair: &KeyPair) -> Vec<u8> {
|
|||
/// Reduction occurs by reducing each validator in a reverse round-robin.
|
||||
pub fn amortize_excess_key_shares(validators: &mut [(Public, u16)]) {
|
||||
let total_key_shares = validators.iter().map(|(_, shares)| shares).sum::<u16>();
|
||||
for i in 0 .. usize::try_from(
|
||||
for i in 0 .. usize::from(
|
||||
total_key_shares.saturating_sub(u16::try_from(MAX_KEY_SHARES_PER_SET).unwrap()),
|
||||
)
|
||||
.unwrap()
|
||||
{
|
||||
) {
|
||||
validators[validators.len() - ((i % validators.len()) + 1)].1 -= 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue