Skip to content

Commit faf1d04

Browse files
author
MarcoFalke
committed
test: Remove redundant sync_with_ping after add_p2p_connection
Also replace the two-line (send_message + sync_with_ping) with the one-line send_and_ping
1 parent fa90647 commit faf1d04

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

test/functional/p2p_dos_header_tree.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def run_test(self):
4747

4848
self.log.info("Feed all non-fork headers, including and up to the first checkpoint")
4949
self.nodes[0].add_p2p_connection(P2PInterface())
50-
self.nodes[0].p2p.send_message(msg_headers(self.headers))
51-
self.nodes[0].p2p.sync_with_ping()
50+
self.nodes[0].p2p.send_and_ping(msg_headers(self.headers))
5251
assert {
5352
'height': 546,
5453
'hash': '000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70',
@@ -65,8 +64,7 @@ def run_test(self):
6564
# On node 0 it succeeds because checkpoints are disabled
6665
self.restart_node(0, extra_args=['-nocheckpoints'])
6766
self.nodes[0].add_p2p_connection(P2PInterface())
68-
self.nodes[0].p2p.send_message(msg_headers(self.headers_fork))
69-
self.nodes[0].p2p.sync_with_ping()
67+
self.nodes[0].p2p.send_and_ping(msg_headers(self.headers_fork))
7068
assert {
7169
"height": 2,
7270
"hash": "00000000b0494bd6c3d5ff79c497cfce40831871cbf39b1bc28bd1dac817dc39",
@@ -76,8 +74,7 @@ def run_test(self):
7674

7775
# On node 1 it succeeds because no checkpoint has been reached yet by a chain tip
7876
self.nodes[1].add_p2p_connection(P2PInterface())
79-
self.nodes[1].p2p.send_message(msg_headers(self.headers_fork))
80-
self.nodes[1].p2p.sync_with_ping()
77+
self.nodes[1].p2p.send_and_ping(msg_headers(self.headers_fork))
8178
assert {
8279
"height": 2,
8380
"hash": "00000000b0494bd6c3d5ff79c497cfce40831871cbf39b1bc28bd1dac817dc39",

test/functional/p2p_invalid_messages.py

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def run_test(self):
140140

141141
# Node is still up.
142142
conn = node.add_p2p_connection(P2PDataStore())
143-
conn.sync_with_ping()
144143

145144
def test_magic_bytes(self):
146145
conn = self.nodes[0].add_p2p_connection(P2PDataStore())

0 commit comments

Comments
 (0)