[net] remove CConnman::AddNewAddresses

It just forwards calls to CAddrMan::Add.
This commit is contained in:
John Newbery committed 2021-03-20 10:24:40 +00:00
1 parent bcd7f30b79
commit 7c4cc67c0c
5 files changed
+4 -18

No files matched your search

-5
View File
@@ -2635,11 +2635,6 @@ CConnman::~CConnman()
Stop(); 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> CConnman::GetAddresses(size_t max_addresses, size_t max_pct)
{ {
std::vector<CAddress> addresses = addrman.GetAddr(max_addresses, max_pct); std::vector<CAddress> addresses = addrman.GetAddr(max_addresses, max_pct);
-1
View File
@@ -921,7 +921,6 @@ public:
}; };
// Addrman functions // 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); std::vector<CAddress> GetAddresses(size_t max_addresses, size_t max_pct);
/** /**
* Cache is used to minimize topology leaks, so it should * Cache is used to minimize topology leaks, so it should
+1 -1
View File
@@ -2681,7 +2681,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
if (fReachable) if (fReachable)
vAddrOk.push_back(addr); 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) if (vAddr.size() < 1000)
pfrom.fGetAddr = false; pfrom.fGetAddr = false;
if (pfrom.IsAddrFetchConn()) { if (pfrom.IsAddrFetchConn()) {
+3 -3
View File
@@ -907,8 +907,8 @@ static RPCHelpMan addpeeraddress()
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{ {
NodeContext& node = EnsureNodeContext(request.context); NodeContext& node = EnsureNodeContext(request.context);
if (!node.connman) { if (!node.addrman) {
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Address manager functionality missing or disabled");
} }
UniValue obj(UniValue::VOBJ); UniValue obj(UniValue::VOBJ);
@@ -925,7 +925,7 @@ static RPCHelpMan addpeeraddress()
address.nTime = GetAdjustedTime(); address.nTime = GetAdjustedTime();
// The source address is set equal to the address. This is equivalent to the peer // The source address is set equal to the address. This is equivalent to the peer
// announcing itself. // announcing itself.
if (!node.connman->AddNewAddresses({address}, address)) { if (!node.addrman->Add(address, address)) {
obj.pushKV("success", false); obj.pushKV("success", false);
return obj; return obj;
} }
-8
View File
@@ -43,14 +43,6 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
[&] { [&] {
random_string = fuzzed_data_provider.ConsumeRandomLengthString(64); 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); connman.AddNode(random_string);
}, },