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

This commit is contained in:
Tyera Eulberg 2019-09-26 19:40:18 -06:00 committed by GitHub
parent a09cf1470a
commit c9e58743e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -163,7 +163,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,