From e5302d85f7639772874d8587eabb0554c7c0a326 Mon Sep 17 00:00:00 2001
From: Cyrix126 <58007246+Cyrix126@users.noreply.github.com>
Date: Fri, 3 Jan 2025 17:56:46 +0100
Subject: [PATCH] fix: false positive disconnection p2pool

---
 src/helper/p2pool.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/helper/p2pool.rs b/src/helper/p2pool.rs
index 72547ab..3318d3a 100644
--- a/src/helper/p2pool.rs
+++ b/src/helper/p2pool.rs
@@ -1082,8 +1082,10 @@ impl PubP2poolApi {
     pub(super) fn update_from_p2p(public: &mut Self, p2p: PrivP2PoolP2PApi) {
         *public = Self {
             p2p_connected: p2p.connections,
-            // 10 seconds before concluding the monero node connection is lost
-            node_connected: p2p.zmq_last_active.is_some_and(|x| x < 10),
+            // above 120s, the node is disconnected.
+            // It will take two minutes to detect that the node is dead.
+            // If the timeframe is reduced, it can have false positive.
+            node_connected: p2p.zmq_last_active.is_some_and(|x| x < 120),
             ..std::mem::take(&mut *public)
         };
     }