From f37ae802360126029b644a880cdc51decbd2104b Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Thu, 14 Nov 2024 08:53:44 +0300 Subject: [PATCH] use safer subtraction on healthcheck expiration check Signed-off-by: onur-ozkan --- mm2src/mm2_main/src/lp_healthcheck.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm2src/mm2_main/src/lp_healthcheck.rs b/mm2src/mm2_main/src/lp_healthcheck.rs index 5e9db51111..820a5ad619 100644 --- a/mm2src/mm2_main/src/lp_healthcheck.rs +++ b/mm2src/mm2_main/src/lp_healthcheck.rs @@ -114,7 +114,7 @@ impl HealthcheckMessage { let now_secs = u64::try_from(Utc::now().timestamp()) .map_err(|e| SignValidationError::Internal { reason: e.to_string() })?; - let remaining_expiration_secs = self.data.expires_at_secs - now_secs; + let remaining_expiration_secs = self.data.expires_at_secs.saturating_sub(now_secs); if remaining_expiration_secs == 0 { return Err(SignValidationError::Expired {