From 4d98bfc5332d908309f6d8997b98999390a2eb3e Mon Sep 17 00:00:00 2001 From: PastaClaw Date: Sat, 20 Jun 2026 05:06:51 -0500 Subject: [PATCH] docs: clarify observed block time --- src/consensus/params.h | 6 ++++++ src/masternode/sync.h | 2 +- src/pow.cpp | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/consensus/params.h b/src/consensus/params.h index 37b5c75f2896..0c1f99825c01 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -166,6 +166,12 @@ struct Params { uint256 powLimit; bool fPowAllowMinDifficultyBlocks; bool fPowNoRetargeting; + /** + * Nominal consensus target spacing. Do not treat it as an exact + * user-facing wall-clock ETA: mainnet's observed spacing is about + * 2.626 min/block due to the historical DGW off-by-one documented by + * DarkGravityWave() in pow.cpp. + */ int64_t nPowTargetSpacing; int64_t nPowTargetTimespan; int nPowKGWHeight; diff --git a/src/masternode/sync.h b/src/masternode/sync.h index 98401982727e..ba4750c05806 100644 --- a/src/masternode/sync.h +++ b/src/masternode/sync.h @@ -20,7 +20,7 @@ static constexpr int MASTERNODE_SYNC_GOVOBJ_VOTE = 11; static constexpr int MASTERNODE_SYNC_FINISHED = 999; static constexpr int MASTERNODE_SYNC_TICK_SECONDS = 6; -static constexpr int MASTERNODE_SYNC_TIMEOUT_SECONDS = 30; // our blocks are 2.5 minutes so 30 seconds should be fine +static constexpr int MASTERNODE_SYNC_TIMEOUT_SECONDS = 30; // nominal target spacing is 2.5 minutes, so 30 seconds should be fine static constexpr int MASTERNODE_SYNC_RESET_SECONDS = 900; // Reset fReachedBestHeader in CMasternodeSync::Reset if UpdateBlockTip hasn't been called for this seconds class NodeSyncNotifier diff --git a/src/pow.cpp b/src/pow.cpp index ed014aeba7ae..a6a79fca4331 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -109,7 +109,10 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const Consens arith_uint256 bnNew(bnPastTargetAvg); int64_t nActualTimespan = pindexLast->GetBlockTime() - pindex->GetBlockTime(); - // NOTE: is this accurate? nActualTimespan counts it for (nPastBlocks - 1) blocks only... + // nActualTimespan spans (nPastBlocks - 1) intervals, while nTargetTimespan + // uses nPastBlocks intervals. Preserve this historical off-by-one DGW + // behavior: it is consensus-critical and makes observed mainnet spacing + // about 2.626 minutes per block rather than the nominal 2.5 minute target. int64_t nTargetTimespan = nPastBlocks * params.nPowTargetSpacing; if (nActualTimespan < nTargetTimespan/3)