From 751658b2be478b70528dfd6f8b506ac7f8d94aee Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Fri, 20 Jul 2018 17:48:51 +1000 Subject: [PATCH] Add saturating sub for deposits --- src/state/transition/deposits.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/state/transition/deposits.rs b/src/state/transition/deposits.rs index fee217615..004dddd00 100644 --- a/src/state/transition/deposits.rs +++ b/src/state/transition/deposits.rs @@ -32,7 +32,8 @@ pub fn process_ffg_deposits( >= cry_state.total_deposits.saturating_mul(U256::from(2)); let mut should_finalize = false; if should_justify { - if cry_state.last_justified_epoch == cry_state.current_epoch - 1 { + if cry_state.last_justified_epoch == + cry_state.current_epoch.saturating_sub(1) { should_finalize = true; } }