mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-31 18:51:12 +00:00
Merge bitcoin/bitcoin#32968: test: fix intermittent failure in rpc_invalidateblock.py
28416f367a5d720d89214aa8ef94013caa1d1a40 test: fix intermittent failure in rpc_invalidateblock.py (stratospher) Pull request description: resolves #32965. node1 (with 24 blocks) causes node0 (with 6 blocks + 1 extra header) to silently reorg. so move the subtest to a point before the 20 blocks are generated so that node1's state doesn't cause node0 to silently reorg. ACKs for top commit: maflcko: lgtm ACK 28416f367a5d720d89214aa8ef94013caa1d1a40 mzumsande: Code Review ACK 28416f367a5d720d89214aa8ef94013caa1d1a40 Tree-SHA512: f6cc682b8e5416125f887c094d5e291dd37f0bfc41d7c0de218f3e24fa1ea0cd642f7a1e362f3127f68cde725a67f3054501326b9bd25f0caa9a05de7d0052b0
This commit is contained in:
commit
0087ba409b
@ -102,6 +102,14 @@ class InvalidateTest(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 3)
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['headers'], 3)
|
||||
|
||||
# Reconsider the header
|
||||
self.nodes[0].reconsiderblock(block.hash)
|
||||
# Since header doesn't have block data, it can't be chain tip
|
||||
# Check if it's possible for an ancestor (with block data) to be the chain tip
|
||||
assert_equal(self.nodes[0].getbestblockhash(), blockhash_6)
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 6)
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['headers'], 7)
|
||||
|
||||
self.log.info("Verify that we reconsider all ancestors as well")
|
||||
blocks = self.generatetodescriptor(self.nodes[1], 10, ADDRESS_BCRT1_UNSPENDABLE_DESCRIPTOR, sync_fun=self.no_op)
|
||||
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
|
||||
@ -128,14 +136,6 @@ class InvalidateTest(BitcoinTestFramework):
|
||||
# Should report consistent blockchain info
|
||||
assert_equal(self.nodes[1].getblockchaininfo()["headers"], self.nodes[1].getblockchaininfo()["blocks"])
|
||||
|
||||
# Reconsider the header
|
||||
self.nodes[0].reconsiderblock(block.hash)
|
||||
# Since header doesn't have block data, it can't be chain tip
|
||||
# Check if it's possible for an ancestor (with block data) to be the chain tip
|
||||
assert_equal(self.nodes[0].getbestblockhash(), blockhash_6)
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 6)
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['headers'], 7)
|
||||
|
||||
self.log.info("Verify that invalidating an unknown block throws an error")
|
||||
assert_raises_rpc_error(-5, "Block not found", self.nodes[1].invalidateblock, "00" * 32)
|
||||
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user