Skip to content

Commit bc4a230

Browse files
author
Antoine Riard
committed
Remove redundant p2p lock tacking for tx download functional tests
New functional test coverage of tx download was added by #19988, but `with p2p_lock` is redundant for some tests with `wait_until` test helper, already guaranteeing test lock tacking.
1 parent d3b5eac commit bc4a230

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

test/functional/p2p_tx_download.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ def test_expiry_fallback(self):
169169
assert_equal(peer_fallback.tx_getdata_count, 0)
170170
self.nodes[0].setmocktime(int(time.time()) + GETDATA_TX_INTERVAL + 1) # Wait for request to peer_expiry to expire
171171
peer_fallback.wait_until(lambda: peer_fallback.tx_getdata_count >= 1, timeout=1)
172-
with p2p_lock:
173-
assert_equal(peer_fallback.tx_getdata_count, 1)
174172
self.restart_node(0) # reset mocktime
175173

176174
def test_disconnect_fallback(self):
@@ -188,8 +186,6 @@ def test_disconnect_fallback(self):
188186
peer_disconnect.peer_disconnect()
189187
peer_disconnect.wait_for_disconnect()
190188
peer_fallback.wait_until(lambda: peer_fallback.tx_getdata_count >= 1, timeout=1)
191-
with p2p_lock:
192-
assert_equal(peer_fallback.tx_getdata_count, 1)
193189

194190
def test_notfound_fallback(self):
195191
self.log.info('Check that notfounds will select another peer for download immediately')
@@ -205,8 +201,6 @@ def test_notfound_fallback(self):
205201
assert_equal(peer_fallback.tx_getdata_count, 0)
206202
peer_notfound.send_and_ping(msg_notfound(vec=[CInv(MSG_WTX, WTXID)])) # Send notfound, so that fallback peer is selected
207203
peer_fallback.wait_until(lambda: peer_fallback.tx_getdata_count >= 1, timeout=1)
208-
with p2p_lock:
209-
assert_equal(peer_fallback.tx_getdata_count, 1)
210204

211205
def test_preferred_inv(self, preferred=False):
212206
if preferred:
@@ -243,8 +237,6 @@ def test_txid_inv_delay(self, glob_wtxid=False):
243237
assert_equal(peer.tx_getdata_count, 0 if glob_wtxid else 1)
244238
self.nodes[0].setmocktime(mock_time + TXID_RELAY_DELAY)
245239
peer.wait_until(lambda: peer.tx_getdata_count >= 1, timeout=1)
246-
with p2p_lock:
247-
assert_equal(peer.tx_getdata_count, 1)
248240

249241
def test_large_inv_batch(self):
250242
self.log.info('Test how large inv batches are handled with relay permission')
@@ -259,8 +251,6 @@ def test_large_inv_batch(self):
259251
peer.send_message(msg_inv([CInv(t=MSG_WTX, h=wtxid) for wtxid in range(MAX_PEER_TX_ANNOUNCEMENTS + 1)]))
260252
peer.wait_until(lambda: peer.tx_getdata_count == MAX_PEER_TX_ANNOUNCEMENTS)
261253
peer.sync_with_ping()
262-
with p2p_lock:
263-
assert_equal(peer.tx_getdata_count, MAX_PEER_TX_ANNOUNCEMENTS)
264254

265255
def test_spurious_notfound(self):
266256
self.log.info('Check that spurious notfound is ignored')

0 commit comments

Comments
 (0)