upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 8a0d112..da22b1d 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -180,6 +180,38 @@ static bool RebuildJob()
180 return false; 180 return false;
181 } 181 }
182 182
183 // The comparison above is blind in the one case that matters most.
184 //
185 // When the node goes deaf -- peers still in vNodes, nothing arriving --
186 // no peer announces anything, GetPeerMedianHeight() returns -1, and the
187 // fallback ("nobody has told us anything, so mine our best chain") let
188 // the pool build a private fork for as long as the deafness lasted.
189 // That fallback is right for a node that has simply not been told yet
190 // and wrong for a node that has stopped being able to hear, and a
191 // height nobody sent cannot tell those apart. Time can.
192 //
193 // Deliberately not behind a debug category, and deliberately not a
194 // silent refusal: an operator whose pool has stopped issuing jobs needs
195 // the reason in the log. /poolmineblind is the escape hatch for a node
196 // that really is alone -- without one, a genuinely isolated pool that is
197 // the majority of the hashrate could never restart its own chain, which
198 // is the deadlock the tip-age check used to cause.
199 if (nPeerHeight < 0 && !fPoolMineBlind) {
200 int64 nAge = GetPeerHeightAgeSecs();
201 if (nAge >= BTF_NO_PEER_HEIGHT_MAX_SECS) {
202 static int64 nLastSaid = 0;
203 if (GetTime() - nLastSaid > 60) {
204 nLastSaid = GetTime();
205 printf("RebuildJob: no peer has reported a height for %d minutes "
206 "-- not issuing jobs (our height %d, %d peers connected). "
207 "This node is deaf; mining now would fork it. "
208 "Pass /poolmineblind to override.\n",
209 (int)(nAge / 60), nBestHeight, (int)vNodes.size());
210 }
211 return false;
212 }
213 }
214
183 CBlockIndex* pindexPrev = pindexBest; 215 CBlockIndex* pindexPrev = pindexBest;
184 unsigned int nBits = GetNextWorkRequired(pindexPrev); 216 unsigned int nBits = GetNextWorkRequired(pindexPrev);
185 217