Skip to content

Commit 1d52405

Browse files
darosiorajtowns
andcommitted
qa: test we don't warn for ignored unknown version bits deployments
Co-Authored-by: Anthony Towns <[email protected]>
1 parent f802edf commit 1d52405

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

‎test/functional/feature_versionbits_warning.py‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
VB_PERIOD = 144 # versionbits period length for regtest
1919
VB_THRESHOLD = 108 # versionbits activation threshold for regtest
2020
VB_TOP_BITS = 0x20000000
21-
VB_UNKNOWN_BIT = 3 # Choose a bit unassigned to any deployment
21+
22+
# Choose a bit unassigned to any deployment, or start the
23+
# node with the deployment matching this bit disabled.
24+
VB_UNKNOWN_BIT = 3
2225
VB_UNKNOWN_VERSION = VB_TOP_BITS | (1 << VB_UNKNOWN_BIT)
26+
VB_IGNORED_BIT = 5
27+
VB_IGNORED_VERSION = VB_TOP_BITS | (1 << VB_IGNORED_BIT)
2328

2429
WARN_UNKNOWN_RULES_ACTIVE = f"Unknown new rules activated (versionbit {VB_UNKNOWN_BIT})"
2530
VB_PATTERN = re.compile("Unknown new rules activated.*versionbit")
@@ -76,11 +81,24 @@ def run_test(self):
7681
assert not VB_PATTERN.match(",".join(node.getmininginfo()["warnings"]))
7782
assert not VB_PATTERN.match(",".join(node.getnetworkinfo()["warnings"]))
7883

84+
self.log.info("Check that there is no warning if previous VB_BLOCKS have VB_PERIOD blocks with ignored versionbits version.")
7985
# Build one period of blocks with VB_THRESHOLD blocks signaling some unknown bit
80-
self.send_blocks_with_version(peer, VB_THRESHOLD, VB_UNKNOWN_VERSION)
86+
self.send_blocks_with_version(peer, VB_THRESHOLD, VB_IGNORED_VERSION)
8187
self.generatetoaddress(node, VB_PERIOD - VB_THRESHOLD, node_deterministic_address)
8288

89+
# Move the ignored deployment state to ACTIVE and make sure we're out of IBD.
90+
self.generatetoaddress(node, VB_PERIOD, node_deterministic_address)
91+
self.wait_until(lambda: not node.getblockchaininfo()['initialblockdownload'])
92+
93+
# Check that we're not getting any versionbit-related warnings in get*info()
94+
assert not VB_PATTERN.match(", ".join(node.getmininginfo()["warnings"]))
95+
assert not VB_PATTERN.match(", ".join(node.getnetworkinfo()["warnings"]))
96+
8397
self.log.info("Check that there is a warning if previous VB_BLOCKS have >=VB_THRESHOLD blocks with unknown versionbits version.")
98+
# Build one period of blocks with VB_THRESHOLD blocks signaling some unknown bit
99+
self.send_blocks_with_version(peer, VB_THRESHOLD, VB_UNKNOWN_VERSION)
100+
self.generatetoaddress(node, VB_PERIOD - VB_THRESHOLD, node_deterministic_address)
101+
84102
# Mine a period worth of expected blocks so the generic block-version warning
85103
# is cleared. This will move the versionbit state to ACTIVE.
86104
self.generatetoaddress(node, VB_PERIOD, node_deterministic_address)

0 commit comments

Comments
 (0)