Skip to content

Commit

Permalink
test: Increase debugging to hunt down mempool_reorg intermittent failure
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Apr 19, 2020
1 parent b470c75 commit fac2fc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 2 additions & 6 deletions test/functional/mempool_reorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def set_test_params(self):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()

alert_filename = None # Set by setup_network

def run_test(self):
# Start with a 200 block chain
assert_equal(self.nodes[0].getblockcount(), 200)
Expand Down Expand Up @@ -76,9 +74,8 @@ def run_test(self):
spend_101_id = self.nodes[0].sendrawtransaction(spend_101_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})
self.sync_all()

for node in self.nodes:
node.invalidateblock(last_block[0])
Expand All @@ -91,10 +88,9 @@ def run_test(self):
for node in self.nodes:
node.invalidateblock(new_blocks[0])

self.sync_all(timeout=720)

# mempool should be empty.
assert_equal(set(self.nodes[0].getrawmempool()), set())
self.sync_all()


if __name__ == '__main__':
Expand Down
12 changes: 10 additions & 2 deletions test/functional/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ def sync_blocks(rpc_connections, *, wait=1, timeout=60):
# Check that each peer has at least one connection
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
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):
Expand All @@ -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
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
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
#############################


def find_output(node, txid, amount, *, blockhash=None):
"""
Return index to output of txid with value amount
Expand Down

0 comments on commit fac2fc4

Please sign in to comment.