Use try_from
This commit is contained in:
@@ -19,7 +19,7 @@ use solana_sdk::{
|
|||||||
stake_history::{StakeHistory, StakeHistoryEntry},
|
stake_history::{StakeHistory, StakeHistoryEntry},
|
||||||
};
|
};
|
||||||
use solana_vote_program::vote_state::{VoteState, VoteStateVersions};
|
use solana_vote_program::vote_state::{VoteState, VoteStateVersions};
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, convert::TryFrom};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy, AbiExample)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy, AbiExample)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
@@ -462,8 +462,7 @@ impl Stake {
|
|||||||
.checked_div(point_value.points)
|
.checked_div(point_value.points)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert!(rewards <= u128::from(std::u64::MAX));
|
let rewards = u64::try_from(rewards).unwrap();
|
||||||
let rewards = rewards as u64;
|
|
||||||
|
|
||||||
// don't bother trying to split if fractional lamports got truncated
|
// don't bother trying to split if fractional lamports got truncated
|
||||||
if rewards == 0 {
|
if rewards == 0 {
|
||||||
|
Reference in New Issue
Block a user