upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-09-02 06:49:28 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-09-02 06:49:28 +0000
commit2a804c2d9736e91271b3209fbc41080c67c100da (patch)
tree490e92c4ac0854cb2740550a945dd64d41ac5db6
parente4f898c4a6b9900553c64b9804889b5fdae3e55f (diff)
worker: log the chain a pool job builds on, not just its id
-rw-r--r--src/main.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7b3e555..3de3db0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4040,8 +4040,29 @@ connected:
4040 jobShared.jobSeq++; 4040 jobShared.jobSeq++;
4041 jobShared.haveJob = true; 4041 jobShared.haveJob = true;
4042 } 4042 }
4043 LogPrint("worker", "[pool->worker] new job %s received\n", 4043 // Log the chain position the pool is
4044 jobId.c_str()); 4044 // building on, so a stale or private
4045 // fork is auditable from worker logs.
4046 // The prevhash comes from the header we
4047 // actually hash (== p[2] of the notify);
4048 // a brief cs_main lookup is safe here --
4049 // this thread holds no other lock.
4050 uint256 hashPrev;
4051 memcpy(&hashPrev, header + 4, 32);
4052 int nPrevHeight = -1;
4053 CRITICAL_BLOCK(cs_main)
4054 {
4055 map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrev);
4056 if (mi != mapBlockIndex.end())
4057 nPrevHeight = (*mi).second->nHeight;
4058 }
4059 if (nPrevHeight >= 0)
4060 LogPrint("worker", "[pool->worker] new job %s received, prevhash %s (known, job height %d)\n",
4061 jobId.c_str(), hashPrev.GetHex().c_str(),
4062 nPrevHeight + 1);
4063 else
4064 LogPrint("worker", "[pool->worker] new job %s received, prevhash %s (unknown to our chain)\n",
4065 jobId.c_str(), hashPrev.GetHex().c_str());
4045 SetParticipantMiningStatus("hashing job " + jobId); 4066 SetParticipantMiningStatus("hashing job " + jobId);
4046 } 4067 }
4047 } 4068 }