Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#30942: test: Remove dead code from interface_zm…
Browse files Browse the repository at this point in the history
…q test

c4dc81f test: Remove dead code from interface_zmq (Fabian Jahr)

Pull request description:

  The loop removed here appears to be effectively dead code: In case `get_raw_seq` is behind `zmq_mem_seq` the loop runs and tries to get a more recent (higher) number for `get_raw_seq`. However, the exact number of `get_raw_seq` is asserted in the line above: `assert_equal(get_raw_seq, 6)`. If the loop would actually achieve its purpose this assert would need to be racy. This does not seem to be the case and 6 appears to be the final number. `zmq_mem_seq` however does take some time to catch up (if it were continue to be updated). But this is not handled by the loop and does not seem to be relevant at this point in the test. The backlog is consumed a bit later in another loop that handles this correctly already.

ACKs for top commit:
  l0rinc:
    ACK c4dc81f
  tdb3:
    CR re ACK c4dc81f

Tree-SHA512: 663a1711ba1ce04a3d2e2916e0df7a7bb51069e28bc2644b816a483628c95b5e6c29fc6eacc31a5f72b7d9af11096f3c437ea1dc57eaa1ee9ddce43cc20bacd3
  • Loading branch information
fanquake committed Oct 28, 2024
2 parents e96ffa9 + c4dc81f commit da10e0b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions test/functional/interface_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,8 @@ def test_mempool_sync(self):
mempool_snapshot = self.nodes[0].getrawmempool(mempool_sequence=True)
mempool_view = set(mempool_snapshot["txids"])
get_raw_seq = mempool_snapshot["mempool_sequence"]
assert_equal(get_raw_seq, 6)
# Snapshot may be too old compared to zmq message we read off latest
while zmq_mem_seq >= get_raw_seq:
sleep(2)
mempool_snapshot = self.nodes[0].getrawmempool(mempool_sequence=True)
mempool_view = set(mempool_snapshot["txids"])
get_raw_seq = mempool_snapshot["mempool_sequence"]
assert_equal(get_raw_seq, num_txs + 1)
assert zmq_mem_seq < get_raw_seq

# Things continue to happen in the "interim" while waiting for snapshot results
# We have node 0 do all these to avoid p2p races with RBF announcements
Expand Down

0 comments on commit da10e0b

Please sign in to comment.