Small code cleanup and typo fixes (#13325)

* Small code cleanup and typo fixes

* Clean up calculate_points_and_credits
This commit is contained in:
Ryo Onodera
2020-11-02 10:28:24 +09:00
committed by GitHub
parent 55b0428ff7
commit 0e4509c497
3 changed files with 28 additions and 22 deletions

View File

@@ -30,8 +30,7 @@ pub const MAX_LOCKOUT_HISTORY: usize = 31;
pub const INITIAL_LOCKOUT: usize = 2;
// Maximum number of credits history to keep around
// smaller numbers makes
pub const MAX_EPOCH_CREDITS_HISTORY: usize = 64;
const MAX_EPOCH_CREDITS_HISTORY: usize = 64;
#[frozen_abi(digest = "Ch2vVEwos2EjAVqSHCyJjnN2MNX1yrpapZTGhMSCjWUH")]
#[derive(Serialize, Default, Deserialize, Debug, PartialEq, Eq, Clone, AbiExample)]
@@ -392,8 +391,7 @@ impl VoteState {
self.epoch_credits.last_mut().unwrap().0 = epoch;
}
// if stakers do not claim before the epoch goes away they lose the
// credits...
// Remove too old epoch_credits
if self.epoch_credits.len() > MAX_EPOCH_CREDITS_HISTORY {
self.epoch_credits.remove(0);
}