Skip to content

Commit 7c4cc67

Browse files
committed
[net] remove CConnman::AddNewAddresses
It just forwards calls to CAddrMan::Add.
1 parent bcd7f30 commit 7c4cc67

File tree

5 files changed

+4
-18
lines changed

5 files changed

+4
-18
lines changed

src/net.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,11 +2635,6 @@ CConnman::~CConnman()
26352635
Stop();
26362636
}
26372637

2638-
bool CConnman::AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty)
2639-
{
2640-
return addrman.Add(vAddr, addrFrom, nTimePenalty);
2641-
}
2642-
26432638
std::vector<CAddress> CConnman::GetAddresses(size_t max_addresses, size_t max_pct)
26442639
{
26452640
std::vector<CAddress> addresses = addrman.GetAddr(max_addresses, max_pct);

src/net.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,6 @@ class CConnman
921921
};
922922

923923
// Addrman functions
924-
bool AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty = 0);
925924
std::vector<CAddress> GetAddresses(size_t max_addresses, size_t max_pct);
926925
/**
927926
* Cache is used to minimize topology leaks, so it should

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
26812681
if (fReachable)
26822682
vAddrOk.push_back(addr);
26832683
}
2684-
m_connman.AddNewAddresses(vAddrOk, pfrom.addr, 2 * 60 * 60);
2684+
m_addrman.Add(vAddrOk, pfrom.addr, 2 * 60 * 60);
26852685
if (vAddr.size() < 1000)
26862686
pfrom.fGetAddr = false;
26872687
if (pfrom.IsAddrFetchConn()) {

src/rpc/net.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,8 @@ static RPCHelpMan addpeeraddress()
907907
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
908908
{
909909
NodeContext& node = EnsureNodeContext(request.context);
910-
if (!node.connman) {
911-
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
910+
if (!node.addrman) {
911+
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Address manager functionality missing or disabled");
912912
}
913913

914914
UniValue obj(UniValue::VOBJ);
@@ -925,7 +925,7 @@ static RPCHelpMan addpeeraddress()
925925
address.nTime = GetAdjustedTime();
926926
// The source address is set equal to the address. This is equivalent to the peer
927927
// announcing itself.
928-
if (!node.connman->AddNewAddresses({address}, address)) {
928+
if (!node.addrman->Add(address, address)) {
929929
obj.pushKV("success", false);
930930
return obj;
931931
}

src/test/fuzz/connman.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
4343
[&] {
4444
random_string = fuzzed_data_provider.ConsumeRandomLengthString(64);
4545
},
46-
[&] {
47-
std::vector<CAddress> addresses;
48-
while (fuzzed_data_provider.ConsumeBool()) {
49-
addresses.push_back(ConsumeAddress(fuzzed_data_provider));
50-
}
51-
// Limit nTimePenalty to int32_t to avoid signed integer overflow
52-
(void)connman.AddNewAddresses(addresses, ConsumeAddress(fuzzed_data_provider), fuzzed_data_provider.ConsumeIntegral<int32_t>());
53-
},
5446
[&] {
5547
connman.AddNode(random_string);
5648
},

0 commit comments

Comments
 (0)