mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
Merge #18704: test: Increase debugging to hunt down mempool_reorg intermittent failure
fac2fc4dd8
test: Increase debugging to hunt down mempool_reorg intermittent failure (MarcoFalke)
Pull request description:
Top commit has no ACKs.
Tree-SHA512: 4094b44afaa623e58b69f8d0332e60f0150b9ae2fd8bb265210d85546d887672ab8a3435cd9b086be14f69ab5b17e0f9fae06bd8aec1e7947ca766dd72b577c4
This commit is contained in:
commit
9ea4d8326a
2 changed files with 12 additions and 8 deletions
|
@ -20,8 +20,6 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
||||||
alert_filename = None # Set by setup_network
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Start with a 200 block chain
|
# Start with a 200 block chain
|
||||||
assert_equal(self.nodes[0].getblockcount(), 200)
|
assert_equal(self.nodes[0].getblockcount(), 200)
|
||||||
|
@ -76,9 +74,8 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
spend_101_id = self.nodes[0].sendrawtransaction(spend_101_raw)
|
spend_101_id = self.nodes[0].sendrawtransaction(spend_101_raw)
|
||||||
spend_102_1_id = self.nodes[0].sendrawtransaction(spend_102_1_raw)
|
spend_102_1_id = self.nodes[0].sendrawtransaction(spend_102_1_raw)
|
||||||
|
|
||||||
self.sync_all(timeout=720)
|
|
||||||
|
|
||||||
assert_equal(set(self.nodes[0].getrawmempool()), {spend_101_id, spend_102_1_id, timelock_tx_id})
|
assert_equal(set(self.nodes[0].getrawmempool()), {spend_101_id, spend_102_1_id, timelock_tx_id})
|
||||||
|
self.sync_all()
|
||||||
|
|
||||||
for node in self.nodes:
|
for node in self.nodes:
|
||||||
node.invalidateblock(last_block[0])
|
node.invalidateblock(last_block[0])
|
||||||
|
@ -91,10 +88,9 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
for node in self.nodes:
|
for node in self.nodes:
|
||||||
node.invalidateblock(new_blocks[0])
|
node.invalidateblock(new_blocks[0])
|
||||||
|
|
||||||
self.sync_all(timeout=720)
|
|
||||||
|
|
||||||
# mempool should be empty.
|
# mempool should be empty.
|
||||||
assert_equal(set(self.nodes[0].getrawmempool()), set())
|
assert_equal(set(self.nodes[0].getrawmempool()), set())
|
||||||
|
self.sync_all()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -410,7 +410,10 @@ def sync_blocks(rpc_connections, *, wait=1, timeout=60):
|
||||||
# Check that each peer has at least one connection
|
# Check that each peer has at least one connection
|
||||||
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
|
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
raise AssertionError("Block sync timed out:{}".format("".join("\n {!r}".format(b) for b in best_hash)))
|
raise AssertionError("Block sync timed out after {}s:{}".format(
|
||||||
|
timeout,
|
||||||
|
"".join("\n {!r}".format(b) for b in best_hash),
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True):
|
def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True):
|
||||||
|
@ -429,11 +432,16 @@ def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True):
|
||||||
# Check that each peer has at least one connection
|
# Check that each peer has at least one connection
|
||||||
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
|
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
raise AssertionError("Mempool sync timed out:{}".format("".join("\n {!r}".format(m) for m in pool)))
|
raise AssertionError("Mempool sync timed out after {}s:{}".format(
|
||||||
|
timeout,
|
||||||
|
"".join("\n {!r}".format(m) for m in pool),
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
# Transaction/Block functions
|
# Transaction/Block functions
|
||||||
#############################
|
#############################
|
||||||
|
|
||||||
|
|
||||||
def find_output(node, txid, amount, *, blockhash=None):
|
def find_output(node, txid, amount, *, blockhash=None):
|
||||||
"""
|
"""
|
||||||
Return index to output of txid with value amount
|
Return index to output of txid with value amount
|
||||||
|
|
Loading…
Add table
Reference in a new issue