Skip to content

Commit

Permalink
test: Increase timeout tolerance of feature_assumeutxo
Browse files Browse the repository at this point in the history
co-authored-by: Andrew Chow <[email protected]>
  • Loading branch information
fjahr and achow101 committed Oct 2, 2023
1 parent cb7e17d commit 45aa654
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/functional/feature_assumeutxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run_test(self):
self.sync_blocks()

def no_sync():
pass
self.no_op

# Generate a series of blocks that `n0` will have in the snapshot,
# but that n1 doesn't yet see. In order for the snapshot to activate,
Expand Down Expand Up @@ -156,19 +156,19 @@ def no_sync():
self.connect_nodes(0, 1)

self.log.info(f"Ensuring snapshot chain syncs to tip. ({FINAL_HEIGHT})")
wait_until_helper(lambda: n1.getchainstates()['snapshot']['blocks'] == FINAL_HEIGHT)
wait_until_helper(lambda: n1.getchainstates()['snapshot']['blocks'] == FINAL_HEIGHT, timeout_factor=2)
self.sync_blocks(nodes=(n0, n1))

self.log.info("Ensuring background validation completes")
# N.B.: the `snapshot` key disappears once the background validation is complete.
wait_until_helper(lambda: not n1.getchainstates().get('snapshot'))
wait_until_helper(lambda: not n1.getchainstates().get('snapshot'), timeout_factor=2)

# Ensure indexes have synced.
completed_idx_state = {
'basic block filter index': COMPLETE_IDX,
'coinstatsindex': COMPLETE_IDX,
}
self.wait_until(lambda: n1.getindexinfo() == completed_idx_state)
self.wait_until(lambda: n1.getindexinfo() == completed_idx_state, timeout=120)


for i in (0, 1):
Expand All @@ -183,7 +183,7 @@ def no_sync():

if i != 0:
# Ensure indexes have synced for the assumeutxo node
self.wait_until(lambda: n.getindexinfo() == completed_idx_state)
self.wait_until(lambda: n.getindexinfo() == completed_idx_state, timeout=120)


# Node 2: all indexes + reindex
Expand All @@ -203,18 +203,18 @@ def no_sync():
assert_equal(monitor['snapshot']['snapshot_blockhash'], dump_output['base_hash'])

self.connect_nodes(0, 2)
wait_until_helper(lambda: n2.getchainstates()['snapshot']['blocks'] == FINAL_HEIGHT)
wait_until_helper(lambda: n2.getchainstates()['snapshot']['blocks'] == FINAL_HEIGHT, timeout_factor=2)
self.sync_blocks()

self.log.info("Ensuring background validation completes")
wait_until_helper(lambda: not n2.getchainstates().get('snapshot'))
wait_until_helper(lambda: not n2.getchainstates().get('snapshot'), timeout_factor=2)

completed_idx_state = {
'basic block filter index': COMPLETE_IDX,
'coinstatsindex': COMPLETE_IDX,
'txindex': COMPLETE_IDX,
}
self.wait_until(lambda: n2.getindexinfo() == completed_idx_state)
self.wait_until(lambda: n2.getindexinfo() == completed_idx_state, timeout=120)

for i in (0, 2):
n = self.nodes[i]
Expand All @@ -228,18 +228,18 @@ def no_sync():

if i != 0:
# Ensure indexes have synced for the assumeutxo node
self.wait_until(lambda: n.getindexinfo() == completed_idx_state)
self.wait_until(lambda: n.getindexinfo() == completed_idx_state, timeout=120)

self.log.info("Test -reindex-chainstate of an assumeutxo-synced node")
self.restart_node(2, extra_args=[
'-reindex-chainstate=1', *self.extra_args[2]])
assert_equal(n2.getblockchaininfo()["blocks"], FINAL_HEIGHT)
wait_until_helper(lambda: n2.getblockcount() == FINAL_HEIGHT)
wait_until_helper(lambda: n2.getblockcount() == FINAL_HEIGHT, timeout_factor=2)

self.log.info("Test -reindex of an assumeutxo-synced node")
self.restart_node(2, extra_args=['-reindex=1', *self.extra_args[2]])
self.connect_nodes(0, 2)
wait_until_helper(lambda: n2.getblockcount() == FINAL_HEIGHT)
wait_until_helper(lambda: n2.getblockcount() == FINAL_HEIGHT, timeout_factor=2)


if __name__ == '__main__':
Expand Down

0 comments on commit 45aa654

Please sign in to comment.