diff options
author | Martin Zumsande <mzumsande@gmail.com> | 2023-07-24 20:31:00 -0400 |
---|---|---|
committer | Martin Zumsande <mzumsande@gmail.com> | 2023-07-25 10:34:29 -0400 |
commit | feb0096139e9e864632d2826d2e213b26146fff1 (patch) | |
tree | 21b4cba4fb94228a329d9358014853cc75489421 /test | |
parent | d23fda05842ba4539b225bbab01b94df0060f697 (diff) | |
download | bitcoin-feb0096139e9e864632d2826d2e213b26146fff1.tar.xz |
test: fix intermittent failure in p2p_getaddr_caching
Only the combined addr:port of source and destination
must be unique. If the destination is different, the same addr:port
for the source may be used by the OS.
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/test_framework/test_node.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 1fcef6ce1c..f01440146b 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -645,10 +645,11 @@ class TestNode(): p2p_conn.sync_with_ping() # Consistency check that the node received our user agent string. - # Find our connection in getpeerinfo by our address:port, as it is unique. + # Find our connection in getpeerinfo by our address:port and theirs, as this combination is unique. sockname = p2p_conn._transport.get_extra_info("socket").getsockname() our_addr_and_port = f"{sockname[0]}:{sockname[1]}" - info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port] + dst_addr_and_port = f"{p2p_conn.dstaddr}:{p2p_conn.dstport}" + info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port and peer["addrbind"] == dst_addr_and_port] assert_equal(len(info), 1) assert_equal(info[0]["subver"], P2P_SUBVERSION) |