@@ -229,8 +229,7 @@ def test_preferred_inv(self, connection_type: ConnectionType):
229
229
else :
230
230
peer = self .nodes [0 ].add_p2p_connection (TestP2PConn ())
231
231
232
- peer .send_message (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
233
- peer .sync_with_ping ()
232
+ peer .send_and_ping (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
234
233
if connection_type != ConnectionType .INBOUND :
235
234
peer .wait_until (lambda : peer .tx_getdata_count >= 1 , timeout = 1 )
236
235
else :
@@ -250,17 +249,15 @@ def test_preferred_tiebreaker_inv(self):
250
249
# of which is preferred and one which is not
251
250
unresponsive_peer = self .nodes [0 ].add_outbound_p2p_connection (
252
251
TestP2PConn (), wait_for_verack = True , p2p_idx = 0 , connection_type = "outbound-full-relay" )
253
- unresponsive_peer .send_message (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
254
- unresponsive_peer .sync_with_ping ()
252
+ unresponsive_peer .send_and_ping (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
255
253
unresponsive_peer .wait_until (lambda : unresponsive_peer .tx_getdata_count >= 1 , timeout = 1 )
256
254
257
255
# A bunch of incoming (non-preferred) connections that advertise the same tx
258
256
non_pref_peers = []
259
257
NUM_INBOUND = 10
260
258
for _ in range (NUM_INBOUND ):
261
259
non_pref_peers .append (self .nodes [0 ].add_p2p_connection (TestP2PConn ()))
262
- non_pref_peers [- 1 ].send_message (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
263
- non_pref_peers [- 1 ].sync_with_ping ()
260
+ non_pref_peers [- 1 ].send_and_ping (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
264
261
265
262
# Check that no request made due to in-flight
266
263
self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY )
@@ -272,8 +269,7 @@ def test_preferred_tiebreaker_inv(self):
272
269
# upon advertisement
273
270
pref_peer = self .nodes [0 ].add_outbound_p2p_connection (
274
271
TestP2PConn (), wait_for_verack = True , p2p_idx = 1 , connection_type = "outbound-full-relay" )
275
- pref_peer .send_message (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
276
- pref_peer .sync_with_ping ()
272
+ pref_peer .send_and_ping (msg_inv ([CInv (t = MSG_WTX , h = 0xff00ff00 )]))
277
273
278
274
assert_equal (len (self .nodes [0 ].getpeerinfo ()), NUM_INBOUND + 2 )
279
275
@@ -302,8 +298,7 @@ def test_txid_inv_delay(self, glob_wtxid=False):
302
298
# Add a second wtxid-relay connection otherwise TXID_RELAY_DELAY is waived in
303
299
# lack of wtxid-relay peers
304
300
self .nodes [0 ].add_p2p_connection (TestP2PConn (wtxidrelay = True ))
305
- peer .send_message (msg_inv ([CInv (t = MSG_TX , h = 0xff11ff11 )]))
306
- peer .sync_with_ping ()
301
+ peer .send_and_ping (msg_inv ([CInv (t = MSG_TX , h = 0xff11ff11 )]))
307
302
with p2p_lock :
308
303
assert_equal (peer .tx_getdata_count , 0 if glob_wtxid else 1 )
309
304
self .nodes [0 ].setmocktime (mock_time + TXID_RELAY_DELAY )
0 commit comments