@@ -1814,6 +1814,16 @@ void PruneAndFlush() {
1814
1814
FlushStateToDisk (state, FLUSH_STATE_NONE);
1815
1815
}
1816
1816
1817
+ static void DoWarning (const std::string& strWarning)
1818
+ {
1819
+ static bool fWarned = false ;
1820
+ SetMiscWarning (strWarning);
1821
+ if (!fWarned ) {
1822
+ AlertNotify (strWarning);
1823
+ fWarned = true ;
1824
+ }
1825
+ }
1826
+
1817
1827
/* * Update chainActive and related internal data structures. */
1818
1828
void static UpdateTip (CBlockIndex *pindexNew, const CChainParams& chainParams) {
1819
1829
chainActive.SetTip (pindexNew);
@@ -1823,7 +1833,6 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) {
1823
1833
1824
1834
cvBlockChange.notify_all ();
1825
1835
1826
- static bool fWarned = false ;
1827
1836
std::vector<std::string> warningMessages;
1828
1837
if (!IsInitialBlockDownload ())
1829
1838
{
@@ -1833,15 +1842,11 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) {
1833
1842
WarningBitsConditionChecker checker (bit);
1834
1843
ThresholdState state = checker.GetStateFor (pindex, chainParams.GetConsensus (), warningcache[bit]);
1835
1844
if (state == THRESHOLD_ACTIVE || state == THRESHOLD_LOCKED_IN) {
1845
+ const std::string strWarning = strprintf (_ (" Warning: unknown new rules activated (versionbit %i)" ), bit);
1836
1846
if (state == THRESHOLD_ACTIVE) {
1837
- std::string strWarning = strprintf (_ (" Warning: unknown new rules activated (versionbit %i)" ), bit);
1838
- SetMiscWarning (strWarning);
1839
- if (!fWarned ) {
1840
- AlertNotify (strWarning);
1841
- fWarned = true ;
1842
- }
1847
+ DoWarning (strWarning);
1843
1848
} else {
1844
- warningMessages.push_back (strprintf ( " unknown new rules are about to activate (versionbit %i) " , bit) );
1849
+ warningMessages.push_back (strWarning );
1845
1850
}
1846
1851
}
1847
1852
}
@@ -1854,16 +1859,12 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) {
1854
1859
pindex = pindex->pprev ;
1855
1860
}
1856
1861
if (nUpgraded > 0 )
1857
- warningMessages.push_back (strprintf (" %d of last 100 blocks have unexpected version" , nUpgraded));
1862
+ warningMessages.push_back (strprintf (_ ( " %d of last 100 blocks have unexpected version" ) , nUpgraded));
1858
1863
if (nUpgraded > 100 /2 )
1859
1864
{
1860
1865
std::string strWarning = _ (" Warning: Unknown block versions being mined! It's possible unknown rules are in effect" );
1861
1866
// notify GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
1862
- SetMiscWarning (strWarning);
1863
- if (!fWarned ) {
1864
- AlertNotify (strWarning);
1865
- fWarned = true ;
1866
- }
1867
+ DoWarning (strWarning);
1867
1868
}
1868
1869
}
1869
1870
LogPrintf (" %s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu date='%s' progress=%f cache=%.1fMiB(%utx)" , __func__,
0 commit comments