Skip to content

Commit

Permalink
fix(test): wait for chainlock before mining a block we expect to incl…
Browse files Browse the repository at this point in the history
…ude said chainlock

Most of the time, while generating the cycle quorum, there is sufficient time to generate a chainlock; however, this is racey, and I've observed locally where the block gets generated before a chainlock is present and as such `test_coinbase_best_cl` fails. We should instead wait for the chainlock first, and then mine the block. This was we can ensure the mined block will include that chainlock.

This was observed locally maybe 1/10 times or so
  • Loading branch information
PastaPastaPasta committed Nov 19, 2024
1 parent f39c1e6 commit 5078bae
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/functional/feature_llmq_chainlocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ def run_test(self):
self.move_to_next_cycle()
self.log.info("Cycle H+2C height:" + str(self.nodes[0].getblockcount()))
self.mine_cycle_quorum(llmq_type_name="llmq_test_dip0024", llmq_type=103)


self.log.info("Mine single block, wait for chainlock")
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash())

self.log.info("Mine single block, ensure it includes latest chainlock")
self.generate(self.nodes[0], 1, sync_fun=self.sync_blocks)
self.test_coinbase_best_cl(self.nodes[0])

# ChainLock locks all the blocks below it so nocl_block_hash should be locked too
Expand Down

0 comments on commit 5078bae

Please sign in to comment.