mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
test: Combine sync_send_with_ping and sync_with_ping
This commit is contained in:
@ -558,16 +558,12 @@ class P2PInterface(P2PConnection):
|
||||
self.send_message(message)
|
||||
self.sync_with_ping(timeout=timeout)
|
||||
|
||||
def sync_send_with_ping(self, timeout=60):
|
||||
"""Ensure SendMessages is called on this connection"""
|
||||
# Calling sync_with_ping twice requires that the node calls
|
||||
def sync_with_ping(self, timeout=60):
|
||||
"""Ensure ProcessMessages and SendMessages is called on this connection"""
|
||||
# Sending two pings back-to-back, requires that the node calls
|
||||
# `ProcessMessage` twice, and thus ensures `SendMessages` must have
|
||||
# been called at least once
|
||||
self.sync_with_ping()
|
||||
self.sync_with_ping()
|
||||
|
||||
def sync_with_ping(self, timeout=60):
|
||||
"""Ensure ProcessMessages is called on this connection"""
|
||||
self.send_message(msg_ping(nonce=0))
|
||||
self.send_message(msg_ping(nonce=self.ping_counter))
|
||||
|
||||
def test_function():
|
||||
|
Reference in New Issue
Block a user