test: Add is_connected_to helper

Needed in the next commit.

Co-Authored-By: David Gumberg <davidzgumberg@gmail.com>
This commit is contained in:
MarcoFalke
2026-01-30 11:18:17 +01:00
parent 4f8bd396f8
commit faa404e119

View File

@@ -914,6 +914,11 @@ class TestNode():
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):
"""Fast forward using setmocktime to self.mocktime + seconds. Requires setmocktime to have
been called at some point in the past."""