mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
scripted-diff: test: Rename send_message to send_without_ping
send_message only drops the bytes in a buffer and a sync is needed to
avoid intermittent test issues. Change the name of the method to make
this more apparent during review.
-BEGIN VERIFY SCRIPT-
sed -i 's/send_message(/send_without_ping(/g' $( git grep -l 'send_message(' )
-END VERIFY SCRIPT-
This commit is contained in:
@@ -38,7 +38,7 @@ class P2PStaller(P2PDataStore):
|
||||
self.getdata_requests.append(inv.hash)
|
||||
if (inv.type & MSG_TYPE_MASK) == MSG_BLOCK:
|
||||
if (inv.hash != self.stall_block):
|
||||
self.send_message(msg_block(self.block_store[inv.hash]))
|
||||
self.send_without_ping(msg_block(self.block_store[inv.hash]))
|
||||
|
||||
def on_getheaders(self, message):
|
||||
pass
|
||||
@@ -78,7 +78,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
||||
for id in range(NUM_PEERS):
|
||||
peers.append(node.add_outbound_p2p_connection(P2PStaller(stall_block), p2p_idx=id, connection_type="outbound-full-relay"))
|
||||
peers[-1].block_store = block_dict
|
||||
peers[-1].send_message(headers_message)
|
||||
peers[-1].send_without_ping(headers_message)
|
||||
|
||||
# Need to wait until 1023 blocks are received - the magic total bytes number is a workaround in lack of an rpc
|
||||
# returning the number of downloaded (but not connected) blocks.
|
||||
@@ -96,7 +96,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
||||
headers_message.headers = [CBlockHeader(b) for b in blocks]
|
||||
with node.assert_debug_log(expected_msgs=['Stall started']):
|
||||
for p in peers:
|
||||
p.send_message(headers_message)
|
||||
p.send_without_ping(headers_message)
|
||||
self.all_sync_send_with_ping(peers)
|
||||
|
||||
self.log.info("Check that the stalling peer is disconnected after 2 seconds")
|
||||
@@ -139,7 +139,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
||||
with node.assert_debug_log(expected_msgs=['Decreased stalling timeout to 2 seconds']):
|
||||
for p in peers:
|
||||
if p.is_connected and (stall_block in p.getdata_requests):
|
||||
p.send_message(msg_block(block_dict[stall_block]))
|
||||
p.send_without_ping(msg_block(block_dict[stall_block]))
|
||||
|
||||
self.log.info("Check that all outstanding blocks get connected")
|
||||
self.wait_until(lambda: node.getblockcount() == NUM_BLOCKS)
|
||||
|
||||
Reference in New Issue
Block a user