From aa79c912608fdc77c69dd43653aa87f1f34e01dd Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Tue, 3 Aug 2021 09:25:38 -0700 Subject: [PATCH 1/2] [docs] Add release notes for #21528 And fix a typo in the test. --- doc/release-notes.md | 4 ++++ src/wallet/test/spend_tests.cpp | 2 +- test/functional/p2p_addr_relay.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index cf9edd9b086..5637f168bb8 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -57,6 +57,10 @@ Notable changes P2P and network changes ----------------------- +- A bitcoind node will no longer rumour addresses to inbound peers by default. + They will become eligible for address gossip after sending an ADDR, ADDRV2, + or GETADDR message. (#21528) + Updated RPCs ------------ diff --git a/src/wallet/test/spend_tests.cpp b/src/wallet/test/spend_tests.cpp index 66e7de4273c..8821f680b33 100644 --- a/src/wallet/test/spend_tests.cpp +++ b/src/wallet/test/spend_tests.cpp @@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE(SubtractFee, TestChain100Setup) // Send full input minus more than the fee amount to recipient, check // leftover input amount is paid to recipient not the miner (to_reduce == // -123). This overpays the recipient instead of overpaying the miner more - // than double the neccesary fee. + // than double the necessary fee. BOOST_CHECK_EQUAL(fee, check_tx(fee + 123)); } diff --git a/test/functional/p2p_addr_relay.py b/test/functional/p2p_addr_relay.py index 95743a1bf54..113e1f9492d 100755 --- a/test/functional/p2p_addr_relay.py +++ b/test/functional/p2p_addr_relay.py @@ -179,7 +179,7 @@ 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. + # Send an empty ADDR message to initialize 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') From 9778b0fec13c047a4c7f3ae425d044da26eadc81 Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Tue, 3 Aug 2021 09:26:29 -0700 Subject: [PATCH 2/2] [net_processing] Provide debug error if code assumptions change. Currently, this call to SetupAddressRelay will never return false because of the previous guard that returns early if the peer is not an inbound connection. Rather than implicitly relying on this guarantee, throw an error in the debug build if it ever changes. --- src/net_processing.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 005fe1bf0cb..754567420c3 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3744,7 +3744,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, return; } - SetupAddressRelay(pfrom, *peer); + // Since this must be an inbound connection, SetupAddressRelay will + // never fail. + Assume(SetupAddressRelay(pfrom, *peer)); // Only send one GetAddr response per connection to reduce resource waste // and discourage addr stamping of INV announcements.