From 8b353da83c5449e31dfc2df1f0270ab13295b83a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 19:08:20 -0700 Subject: [PATCH] Prevent subtract overflow panic when slot < MAX_LOCKOUT_HISTORY (#6135) (#6136) automerge --- core/src/rpc.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/rpc.rs b/core/src/rpc.rs index 942c757a0a..a52ab23772 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -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,