diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2024-06-29 00:10:25 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2024-06-29 00:30:14 +0200 |
commit | 5d2fb14bafe4e80c0a482d99e5ebde07c477f000 (patch) | |
tree | 3ac638068f154a2e30f12abb376c84434b28ef0f | |
parent | 2f6dca4d1c01ee47275a4292f128d714736837a1 (diff) |
test: p2p: check that connecting to ourself leads to disconnect
The "connect to ourself" detection logic has been first introduced
by Satoshi in October 2009, together with a couple of other changes
and a version bump to "v0.1.6 BETA" (see commit
cc0b4c3b62367a2aebe5fc1f4d0ed4b97e9c2ac9).
-rwxr-xr-x | test/functional/p2p_handshake.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/p2p_handshake.py b/test/functional/p2p_handshake.py index dd19fe9333..673322ab10 100755 --- a/test/functional/p2p_handshake.py +++ b/test/functional/p2p_handshake.py @@ -17,6 +17,7 @@ from test_framework.messages import ( NODE_WITNESS, ) from test_framework.p2p import P2PInterface +from test_framework.util import p2p_port # Desirable service flags for outbound non-pruned and pruned peers. Note that @@ -88,6 +89,12 @@ class P2PHandshakeTest(BitcoinTestFramework): with node.assert_debug_log([f"feeler connection completed"]): self.add_outbound_connection(node, "feeler", NODE_NONE, wait_for_disconnect=True) + self.log.info("Check that connecting to ourself leads to immediate disconnect") + with node.assert_debug_log(["connected to self", "disconnecting"]): + node_listen_addr = f"127.0.0.1:{p2p_port(0)}" + node.addconnection(node_listen_addr, "outbound-full-relay", self.options.v2transport) + self.wait_until(lambda: len(node.getpeerinfo()) == 0) + if __name__ == '__main__': P2PHandshakeTest().main() |