Skip to content

Commit d88f7f8

Browse files
author
MarcoFalke
committed
Merge #15471: rpc/gui: Remove 'Unknown block versions being mined' warning
ef362f2 rpc/gui: Remove 'Unknown block versions being mined' warning (Wladimir J. van der Laan) Pull request description: Due to miners inserting garbage into the version numbers causing false positives, the current version signalling has become completely useless. This removes the "unknown block versions" warning which has the tendency to scare users unnecessarily (and might get them to "update" to something bad). It preserves the warning in the logs. Whether this is desirable can be a point of discussion. Tree-SHA512: 51407ccd24a571462465d9c7180f0f28307c50b82a03284abe783e181d8ab7e0638dbb710698d883f28de8a609db70763e39be2470d956e67c833da0768e43e9
2 parents 8f470ec + ef362f2 commit d88f7f8

File tree

3 files changed

+1
-29
lines changed

3 files changed

+1
-29
lines changed

src/validation.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,12 +2259,6 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
22592259
}
22602260
if (nUpgraded > 0)
22612261
AppendWarning(warningMessages, strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded));
2262-
if (nUpgraded > 100/2)
2263-
{
2264-
std::string strWarning = _("Warning: Unknown block versions being mined! It's possible unknown rules are in effect");
2265-
// notify GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
2266-
DoWarning(strWarning);
2267-
}
22682262
}
22692263
LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)", __func__, /* Continued */
22702264
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, pindexNew->nVersion,

test/functional/feature_notifications.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,7 @@ def run_test(self):
6666
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
6767
assert_equal(sorted(txids_rpc), sorted(os.listdir(self.walletnotify_dir)))
6868

69-
# Mine another 41 up-version blocks. -alertnotify should trigger on the 51st.
70-
self.log.info("test -alertnotify")
71-
self.nodes[1].generatetoaddress(41, ADDRESS_BCRT1_UNSPENDABLE)
72-
self.sync_all()
73-
74-
# Give bitcoind 10 seconds to write the alert notification
75-
wait_until(lambda: len(os.listdir(self.alertnotify_dir)), timeout=10)
76-
77-
for notify_file in os.listdir(self.alertnotify_dir):
78-
os.remove(os.path.join(self.alertnotify_dir, notify_file))
79-
80-
# Mine more up-version blocks, should not get more alerts:
81-
self.nodes[1].generatetoaddress(2, ADDRESS_BCRT1_UNSPENDABLE)
82-
self.sync_all()
83-
84-
self.log.info("-alertnotify should not continue notifying for more unknown version blocks")
85-
assert_equal(len(os.listdir(self.alertnotify_dir)), 0)
69+
# TODO: add test for `-alertnotify` large fork notifications
8670

8771
if __name__ == '__main__':
8872
NotificationsTest().main()

test/functional/feature_versionbits_warning.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
VB_UNKNOWN_BIT = 27 # Choose a bit unassigned to any deployment
2323
VB_UNKNOWN_VERSION = VB_TOP_BITS | (1 << VB_UNKNOWN_BIT)
2424

25-
WARN_UNKNOWN_RULES_MINED = "Unknown block versions being mined! It's possible unknown rules are in effect"
2625
WARN_UNKNOWN_RULES_ACTIVE = "unknown new rules activated (versionbit {})".format(VB_UNKNOWN_BIT)
2726
VB_PATTERN = re.compile("Warning: unknown new rules activated.*versionbit")
2827

@@ -78,15 +77,10 @@ def run_test(self):
7877
assert(not VB_PATTERN.match(node.getmininginfo()["warnings"]))
7978
assert(not VB_PATTERN.match(node.getnetworkinfo()["warnings"]))
8079

81-
self.log.info("Check that there is a warning if >50 blocks in the last 100 were an unknown version")
8280
# Build one period of blocks with VB_THRESHOLD blocks signaling some unknown bit
8381
self.send_blocks_with_version(node.p2p, VB_THRESHOLD, VB_UNKNOWN_VERSION)
8482
node.generatetoaddress(VB_PERIOD - VB_THRESHOLD, node_deterministic_address)
8583

86-
# Check that get*info() shows the 51/100 unknown block version error.
87-
assert(WARN_UNKNOWN_RULES_MINED in node.getmininginfo()["warnings"])
88-
assert(WARN_UNKNOWN_RULES_MINED in node.getnetworkinfo()["warnings"])
89-
9084
self.log.info("Check that there is a warning if previous VB_BLOCKS have >=VB_THRESHOLD blocks with unknown versionbits version.")
9185
# Mine a period worth of expected blocks so the generic block-version warning
9286
# is cleared. This will move the versionbit state to ACTIVE.

0 commit comments

Comments
 (0)