aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_addr_relay.py
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2021-03-24 15:01:05 -0700
committerAmiti Uttarwar <amiti@uttarwar.org>2021-07-29 17:40:21 -0700
commit1d1ef2db7ea0d93c7dab4a9800ec74afa7a019eb (patch)
tree816fb1785c870224e64dd6eb09ba1daad221d28e /test/functional/p2p_addr_relay.py
parent6653fa3328b5608fcceda1c6ea8e68c5d58739ec (diff)
downloadbitcoin-1d1ef2db7ea0d93c7dab4a9800ec74afa7a019eb.tar.xz
[net_processing] Defer initializing m_addr_known
Use SetupAddressRelay to only initialize `m_addr_known` as needed. For outbound peers, we initialize the filter before sending our self announcement (not applicable for block-relay-only connections). For inbound peers, we initialize the filter when we get an addr related message (ADDR, ADDRV2, GETADDR). These changes intend to mitigate address blackholes. Since an inbound peer has to send us an addr related message to become eligible as a candidate for addr relay, this should reduce our likelihood of sending them self-announcements.
Diffstat (limited to 'test/functional/p2p_addr_relay.py')
-rwxr-xr-xtest/functional/p2p_addr_relay.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/functional/p2p_addr_relay.py b/test/functional/p2p_addr_relay.py
index 7b7bcfc917..c8c1120462 100755
--- a/test/functional/p2p_addr_relay.py
+++ b/test/functional/p2p_addr_relay.py
@@ -175,6 +175,9 @@ class AddrTest(BitcoinTestFramework):
# of the outbound peer which is often sent before the GETADDR response.
assert_equal(inbound_peer.num_ipv4_received, 0)
+ # Send an empty ADDR message to intialize address relay on this connection.
+ inbound_peer.send_and_ping(msg_addr())
+
self.log.info('Check that subsequent addr messages sent from an outbound peer are relayed')
msg2 = self.setup_addr_msg(2)
self.send_addr_msg(full_outbound_peer, msg2, [inbound_peer])