From 03e3a6eb742c8a578695e81703c1a2fd5d6bfb33 Mon Sep 17 00:00:00 2001 From: frstrtr Date: Sat, 11 Jul 2026 04:11:15 +0000 Subject: [PATCH] feat(core/stratum): per-session doa_shares_ counter on block-template-changed submit Split out of #665 (threetier wirecompat harness) per the integrator scope ruling: src/core is the shared exceptional-only lane, so this prod-accounting change must travel as its own reviewable diff rather than ride a test-harness PR. Increments doa_shares_ in StratumSession::handle_submit when the block template changed between job issue and submit (live-vs-frozen prevhash mismatch). Accounting only: the share is still created and broadcast (matches p2pool); no PPLNS/consensus path touched. NOTE: counter is currently write-only (no dashboard consumer yet). Requires an explicit justification + all four coin smokes green before merge. --- src/core/stratum_server.cpp | 1 + src/core/stratum_server.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/stratum_server.cpp b/src/core/stratum_server.cpp index a979cbe1e..f72da1a7e 100644 --- a/src/core/stratum_server.cpp +++ b/src/core/stratum_server.cpp @@ -936,6 +936,7 @@ nlohmann::json StratumSession::handle_submit(const nlohmann::json& params, const << ": block template changed (job=" << job_id << " job_prev=" << job_it->second.gbt_prevhash.substr(0, 16) << " current_prev=" << current_prevhash.substr(0, 16) << ")"; + ++doa_shares_; // DON'T set job.stale_info here — it would break ref_hash. // The share is still created and broadcast (matches p2pool behavior). // DOA tracking is for statistics/dashboard only. diff --git a/src/core/stratum_server.hpp b/src/core/stratum_server.hpp index 33f0f147d..7d6e68993 100644 --- a/src/core/stratum_server.hpp +++ b/src/core/stratum_server.hpp @@ -154,6 +154,7 @@ class StratumSession : public std::enable_shared_from_this uint64_t accepted_shares_ = 0; uint64_t rejected_shares_ = 0; uint64_t stale_shares_ = 0; + uint64_t doa_shares_ = 0; // block-template changed at submit (live-vs-frozen prevhash mismatch); accounting only, share still broadcasts std::chrono::steady_clock::time_point connected_at_; std::string session_id_;