upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-08-11 20:52:09 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-08-23 04:37:36 +0000
commit3d7c30ebb6ac0c586635c693a40bc39180f539b9 (patch)
treefc4b0db498c03fdab8244fd4a2a3360db77aa0b9 /src/main.h
parent090628b34d1aefc7029be37d7bc8512b5edb3ca5 (diff)
pool: refuse jobs when no peer has reported a height for 20 minutes
The peer-height gate replaced a tip-age check that was wrong in both directions. It is a strict improvement and it is still blind in the one case that matters most. When the node goes deaf -- peers still in vNodes, nothing arriving -- no peer announces anything, GetPeerMedianHeight() returns -1, and the fallback mines our best chain. That fallback is right for a node that has not been told yet and wrong for a node that has stopped being able to hear, and a height nobody sent cannot tell those apart. A wedged node is exactly a node with no peer height information, so the gate was silent for the whole of heights 3966-4085: 120 blocks, 5890.50 BTF voided. Time can tell them apart. GetPeerHeightAgeSecs() measures how long since any peer reported a height, counting from first use rather than the epoch so a starting node does not refuse jobs before its first handshake. Past 20 minutes the pool stops issuing jobs and says so unconditionally in the log. /poolmineblind overrides it: without an escape hatch a genuinely isolated pool that is 90% of the hashrate could never restart its own chain, which is the deadlock the tip-age check used to cause. Also stop nStartingHeight from going stale. It was a snapshot taken once during the version handshake and never touched again, so on a long-lived connection the median is built from heights the peers had hours ago, and the behind-the-network check drifts toward 'everyone is behind us' and quietly stops firing. A peer that hands us a block is demonstrably at least at that block's height. (cherry picked from commit 0800c18faf703b4acde1b131d0b742d37a86d92b)
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index 6b1ff0a..f5409e9 100644
--- a/src/main.h
+++ b/src/main.h
@@ -93,6 +93,7 @@ extern string strParticipantPool; // participant: pool .btf address
93extern string strPayoutAddress; // participant: /payoutaddr override (mine without a wallet) 93extern string strPayoutAddress; // participant: /payoutaddr override (mine without a wallet)
94extern string strPayoutFile; // participant: /payoutfile address list, rotated per reconnect 94extern string strPayoutFile; // participant: /payoutfile address list, rotated per reconnect
95extern bool fPoolNoAnnounce; // /noannounce: suppress pool announcements 95extern bool fPoolNoAnnounce; // /noannounce: suppress pool announcements
96extern bool fPoolMineBlind; // /poolmineblind: mine on even when deaf to every peer
96extern int nHashThreads; // participant: /hashthreads override (0 = cores-1) 97extern int nHashThreads; // participant: /hashthreads override (0 = cores-1)
97extern string strPoolName; // operator: announced pool name 98extern string strPoolName; // operator: announced pool name
98extern string strPoolDashboardUrl; // operator: optional dashboard URL 99extern string strPoolDashboardUrl; // operator: optional dashboard URL