mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 14:45:08 +01:00
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.
This commit is contained in:
parent
d23fda0584
commit
feb0096139
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user