Prevent subtract overflow panic when slot < MAX_LOCKOUT_HISTORY (#6135) (#6136)

automerge
This commit is contained in:
mergify[bot]
2019-09-26 19:08:20 -07:00
committed by Grimes
parent 61930c0dd3
commit 8b353da83c

View File

@ -159,7 +159,11 @@ impl JsonRpcRequestProcessor {
}
})
.partition(|vote_account_info| {
vote_account_info.last_vote >= bank.slot() - MAX_LOCKOUT_HISTORY as u64
if bank.slot() >= MAX_LOCKOUT_HISTORY as u64 {
vote_account_info.last_vote > bank.slot() - MAX_LOCKOUT_HISTORY as u64
} else {
vote_account_info.last_vote > 0
}
});
Ok(RpcVoteAccountStatus {
current: current_vote_accounts,