From d706dec3fcb861f34dae0ebbd9f1a995656b9ec8 Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Sat, 20 Jul 2024 14:17:37 +0200 Subject: [PATCH] feat: fix overflow time left --- src/helper/xvb/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helper/xvb/mod.rs b/src/helper/xvb/mod.rs index 3f9c460..8228d80 100644 --- a/src/helper/xvb/mod.rs +++ b/src/helper/xvb/mod.rs @@ -822,8 +822,10 @@ fn update_indicator_algo( // algo is mining on p2pool but will switch to XvB after // show time remaining on p2pool lock!(pub_api).stats_priv.time_switch_node = XVB_TIME_ALGO - - last_algorithm.lock().unwrap().elapsed().as_secs() as u32 - - time_donated; + .checked_sub(last_algorithm.lock().unwrap().elapsed().as_secs() as u32) + .unwrap_or_default() + .checked_sub(time_donated) + .unwrap_or_default(); "time until switch to mining on XvB".to_string() } _ => {