|
|
@ -1814,6 +1814,16 @@ void PruneAndFlush() { |
|
|
|
FlushStateToDisk(state, FLUSH_STATE_NONE); |
|
|
|
FlushStateToDisk(state, FLUSH_STATE_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void DoWarning(const std::string& strWarning) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
static bool fWarned = false; |
|
|
|
|
|
|
|
SetMiscWarning(strWarning); |
|
|
|
|
|
|
|
if (!fWarned) { |
|
|
|
|
|
|
|
AlertNotify(strWarning); |
|
|
|
|
|
|
|
fWarned = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Update chainActive and related internal data structures. */ |
|
|
|
/** Update chainActive and related internal data structures. */ |
|
|
|
void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) { |
|
|
|
void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) { |
|
|
|
chainActive.SetTip(pindexNew); |
|
|
|
chainActive.SetTip(pindexNew); |
|
|
@ -1823,7 +1833,6 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) { |
|
|
|
|
|
|
|
|
|
|
|
cvBlockChange.notify_all(); |
|
|
|
cvBlockChange.notify_all(); |
|
|
|
|
|
|
|
|
|
|
|
static bool fWarned = false; |
|
|
|
|
|
|
|
std::vector<std::string> warningMessages; |
|
|
|
std::vector<std::string> warningMessages; |
|
|
|
if (!IsInitialBlockDownload()) |
|
|
|
if (!IsInitialBlockDownload()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1833,15 +1842,11 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) { |
|
|
|
WarningBitsConditionChecker checker(bit); |
|
|
|
WarningBitsConditionChecker checker(bit); |
|
|
|
ThresholdState state = checker.GetStateFor(pindex, chainParams.GetConsensus(), warningcache[bit]); |
|
|
|
ThresholdState state = checker.GetStateFor(pindex, chainParams.GetConsensus(), warningcache[bit]); |
|
|
|
if (state == THRESHOLD_ACTIVE || state == THRESHOLD_LOCKED_IN) { |
|
|
|
if (state == THRESHOLD_ACTIVE || state == THRESHOLD_LOCKED_IN) { |
|
|
|
|
|
|
|
const std::string strWarning = strprintf(_("Warning: unknown new rules activated (versionbit %i)"), bit); |
|
|
|
if (state == THRESHOLD_ACTIVE) { |
|
|
|
if (state == THRESHOLD_ACTIVE) { |
|
|
|
std::string strWarning = strprintf(_("Warning: unknown new rules activated (versionbit %i)"), bit); |
|
|
|
DoWarning(strWarning); |
|
|
|
SetMiscWarning(strWarning); |
|
|
|
|
|
|
|
if (!fWarned) { |
|
|
|
|
|
|
|
AlertNotify(strWarning); |
|
|
|
|
|
|
|
fWarned = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
warningMessages.push_back(strprintf("unknown new rules are about to activate (versionbit %i)", bit)); |
|
|
|
warningMessages.push_back(strWarning); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1854,16 +1859,12 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) { |
|
|
|
pindex = pindex->pprev; |
|
|
|
pindex = pindex->pprev; |
|
|
|
} |
|
|
|
} |
|
|
|
if (nUpgraded > 0) |
|
|
|
if (nUpgraded > 0) |
|
|
|
warningMessages.push_back(strprintf("%d of last 100 blocks have unexpected version", nUpgraded)); |
|
|
|
warningMessages.push_back(strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded)); |
|
|
|
if (nUpgraded > 100/2) |
|
|
|
if (nUpgraded > 100/2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string strWarning = _("Warning: Unknown block versions being mined! It's possible unknown rules are in effect"); |
|
|
|
std::string strWarning = _("Warning: Unknown block versions being mined! It's possible unknown rules are in effect"); |
|
|
|
// notify GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
|
|
|
|
// notify GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
|
|
|
|
SetMiscWarning(strWarning); |
|
|
|
DoWarning(strWarning); |
|
|
|
if (!fWarned) { |
|
|
|
|
|
|
|
AlertNotify(strWarning); |
|
|
|
|
|
|
|
fWarned = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu date='%s' progress=%f cache=%.1fMiB(%utx)", __func__, |
|
|
|
LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu date='%s' progress=%f cache=%.1fMiB(%utx)", __func__, |
|
|
|