mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
[net] remove CConnman::AddNewAddresses
It just forwards calls to CAddrMan::Add.
This commit is contained in:
parent
bcd7f30b79
commit
7c4cc67c0c
5 changed files with 4 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -43,14 +43,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);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue