MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / sync_with_ping

Method sync_with_ping

test/functional/test_framework/p2p.py:714–726  ·  view source on GitHub ↗

Ensure ProcessMessages and SendMessages is called on this connection

(self, *, timeout=60)

Source from the content-addressed store, hash-verified

712 self.sync_with_ping(timeout=timeout)
713
714 def sync_with_ping(self, *, timeout=60):
715 """Ensure ProcessMessages and SendMessages is called on this connection"""
716 # Sending two pings back-to-back, requires that the node calls
717 # `ProcessMessage` twice, and thus ensures `SendMessages` must have
718 # been called at least once
719 self.send_without_ping(msg_ping(nonce=0))
720 self.send_without_ping(msg_ping(nonce=self.ping_counter))
721
722 def test_function():
723 return self.last_message.get("pong") and self.last_message["pong"].nonce == self.ping_counter
724
725 self.wait_until(test_function, timeout=timeout)
726 self.ping_counter += 1
727
728
729# One lock for synchronizing all data access between the network event loop (see

Callers 15

send_and_pingMethod · 0.95
test_null_locatorsMethod · 0.80
test_nonnull_locatorsMethod · 0.80
test_reorg_relayMethod · 0.80
run_testMethod · 0.80
run_testMethod · 0.80
run_testMethod · 0.80
run_testMethod · 0.80

Calls 3

wait_untilMethod · 0.95
msg_pingClass · 0.90
send_without_pingMethod · 0.80

Tested by 15

test_null_locatorsMethod · 0.64
test_nonnull_locatorsMethod · 0.64
test_reorg_relayMethod · 0.64
test_bufferMethod · 0.64
test_checksumMethod · 0.64
test_msgtypeMethod · 0.64
test_addrv2Method · 0.64