From 0732bab78a7f85977d44010978a3a5737883a90c Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Tue, 31 Dec 2024 14:45:31 +0100 Subject: [PATCH] fix: handle case where zmq-last_active is not present --- src/helper/p2pool.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helper/p2pool.rs b/src/helper/p2pool.rs index 5242c55..26d8f5f 100644 --- a/src/helper/p2pool.rs +++ b/src/helper/p2pool.rs @@ -1044,7 +1044,7 @@ impl PubP2poolApi { *public = Self { p2p_connected: p2p.connections, // 30 seconds before concluding the monero node connection is lost - node_connected: p2p.zmq_last_active < 30, + node_connected: p2p.zmq_last_active.is_some_and(|x| x < 30), ..std::mem::take(&mut *public) }; } @@ -1358,7 +1358,7 @@ impl PoolStatistics { #[derive(Debug, Serialize, Deserialize, Clone)] pub(super) struct PrivP2PoolP2PApi { pub connections: u32, - pub zmq_last_active: u32, + pub zmq_last_active: Option, } impl Default for PrivP2PoolP2PApi { @@ -1371,7 +1371,7 @@ impl PrivP2PoolP2PApi { fn new() -> Self { Self { connections: 0, - zmq_last_active: 0, + zmq_last_active: None, } }