From 58a1a70dfbf5238823451e62e45c3e20fe4436bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20=C3=96zkan?= Date: Thu, 14 Nov 2024 10:44:33 +0300 Subject: [PATCH] use safer subtraction on healthcheck expiration check (#2272) 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 {