test: Fix intermittent issue in p2p_addr_relay.py

This commit is contained in:
MarcoFalke
2021-04-27 13:32:23 +02:00
parent fa37116c82
commit faa51ef4d3
4 changed files with 12 additions and 9 deletions

View File

@@ -539,8 +539,16 @@ class P2PInterface(P2PConnection):
self.send_message(message)
self.sync_with_ping(timeout=timeout)
# Sync up with the node
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
# `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=self.ping_counter))
def test_function():