diff options
author | John Newbery <john@johnnewbery.com> | 2020-10-23 10:24:16 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-03-20 10:24:40 +0000 |
commit | 7c4cc67c0c3c50df004ee53cac5b2884b7fbab29 (patch) | |
tree | 46a6057a19abb8d7c21d5c613fedec49c143041c /src | |
parent | bcd7f30b7944892db7ae37069175804567bb0cdf (diff) | |
download | bitcoin-7c4cc67c0c3c50df004ee53cac5b2884b7fbab29.tar.xz |
[net] remove CConnman::AddNewAddresses
It just forwards calls to CAddrMan::Add.
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 5 | ||||
-rw-r--r-- | src/net.h | 1 | ||||
-rw-r--r-- | src/net_processing.cpp | 2 | ||||
-rw-r--r-- | src/rpc/net.cpp | 6 | ||||
-rw-r--r-- | src/test/fuzz/connman.cpp | 8 |
5 files changed, 4 insertions, 18 deletions
diff --git a/src/net.cpp b/src/net.cpp index 0e5909612e..9553bbddfa 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2635,11 +2635,6 @@ CConnman::~CConnman() Stop(); } -bool CConnman::AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty) -{ - return addrman.Add(vAddr, addrFrom, nTimePenalty); -} - std::vector<CAddress> CConnman::GetAddresses(size_t max_addresses, size_t max_pct) { std::vector<CAddress> addresses = addrman.GetAddr(max_addresses, max_pct); @@ -921,7 +921,6 @@ public: }; // Addrman functions - bool AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty = 0); std::vector<CAddress> GetAddresses(size_t max_addresses, size_t max_pct); /** * Cache is used to minimize topology leaks, so it should diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ff1e46eb67..4b91d86cfa 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2681,7 +2681,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, if (fReachable) vAddrOk.push_back(addr); } - m_connman.AddNewAddresses(vAddrOk, pfrom.addr, 2 * 60 * 60); + m_addrman.Add(vAddrOk, pfrom.addr, 2 * 60 * 60); if (vAddr.size() < 1000) pfrom.fGetAddr = false; if (pfrom.IsAddrFetchConn()) { diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index d4c1ab4b53..96533a50c8 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -907,8 +907,8 @@ static RPCHelpMan addpeeraddress() [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureNodeContext(request.context); - if (!node.connman) { - throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); + if (!node.addrman) { + throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Address manager functionality missing or disabled"); } UniValue obj(UniValue::VOBJ); @@ -925,7 +925,7 @@ static RPCHelpMan addpeeraddress() address.nTime = GetAdjustedTime(); // The source address is set equal to the address. This is equivalent to the peer // announcing itself. - if (!node.connman->AddNewAddresses({address}, address)) { + if (!node.addrman->Add(address, address)) { obj.pushKV("success", false); return obj; } diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp index dec580ea22..e07f25dedf 100644 --- a/src/test/fuzz/connman.cpp +++ b/src/test/fuzz/connman.cpp @@ -44,14 +44,6 @@ FUZZ_TARGET_INIT(connman, initialize_connman) random_string = fuzzed_data_provider.ConsumeRandomLengthString(64); }, [&] { - std::vector<CAddress> addresses; - while (fuzzed_data_provider.ConsumeBool()) { - addresses.push_back(ConsumeAddress(fuzzed_data_provider)); - } - // Limit nTimePenalty to int32_t to avoid signed integer overflow - (void)connman.AddNewAddresses(addresses, ConsumeAddress(fuzzed_data_provider), fuzzed_data_provider.ConsumeIntegral<int32_t>()); - }, - [&] { connman.AddNode(random_string); }, [&] { |