mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
[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.
This commit is contained in:
@ -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])
|
||||
|
Reference in New Issue
Block a user