test: Add is_connected_to helper

Needed in the next commit.

Co-Authored-By: David Gumberg <davidzgumberg@gmail.com>

Github-Pull: #34425
Rebased-From: faa404e119
This commit is contained in:
MarcoFalke
2026-01-30 11:18:17 +01:00
committed by fanquake
parent e1545b56b9
commit 332d2a2ef2

View File

@@ -920,6 +920,11 @@ class TestNode():
self.wait_until(lambda: self.num_test_p2p_connections() == 0) self.wait_until(lambda: self.num_test_p2p_connections() == 0)
def is_connected_to(self, other):
assert isinstance(other, TestNode)
other_subver = other.getnetworkinfo()["subversion"]
return any(peer["subver"] == other_subver for peer in self.getpeerinfo())
def bumpmocktime(self, seconds): def bumpmocktime(self, seconds):
"""Fast forward using setmocktime to self.mocktime + seconds. Requires setmocktime to have """Fast forward using setmocktime to self.mocktime + seconds. Requires setmocktime to have
been called at some point in the past.""" been called at some point in the past."""