|
18 | 18 | VB_PERIOD = 144 # versionbits period length for regtest |
19 | 19 | VB_THRESHOLD = 108 # versionbits activation threshold for regtest |
20 | 20 | 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 |
22 | 25 | 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) |
23 | 28 |
|
24 | 29 | WARN_UNKNOWN_RULES_ACTIVE = f"Unknown new rules activated (versionbit {VB_UNKNOWN_BIT})" |
25 | 30 | VB_PATTERN = re.compile("Unknown new rules activated.*versionbit") |
@@ -76,11 +81,24 @@ def run_test(self): |
76 | 81 | assert not VB_PATTERN.match(",".join(node.getmininginfo()["warnings"])) |
77 | 82 | assert not VB_PATTERN.match(",".join(node.getnetworkinfo()["warnings"])) |
78 | 83 |
|
| 84 | + self.log.info("Check that there is no warning if previous VB_BLOCKS have VB_PERIOD blocks with ignored versionbits version.") |
79 | 85 | # 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) |
81 | 87 | self.generatetoaddress(node, VB_PERIOD - VB_THRESHOLD, node_deterministic_address) |
82 | 88 |
|
| 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 | + |
83 | 97 | 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 | + |
84 | 102 | # Mine a period worth of expected blocks so the generic block-version warning |
85 | 103 | # is cleared. This will move the versionbit state to ACTIVE. |
86 | 104 | self.generatetoaddress(node, VB_PERIOD, node_deterministic_address) |
|
0 commit comments