Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/masternode/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading