MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetAddr_

Method GetAddr_

src/addrman.cpp:474–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472#endif
473
474void CAddrMan::GetAddr_(std::vector<CAddress>& vAddr)
475{
476 unsigned int nNodes = ADDRMAN_GETADDR_MAX_PCT * vRandom.size() / 100;
477 if (nNodes > ADDRMAN_GETADDR_MAX)
478 nNodes = ADDRMAN_GETADDR_MAX;
479
480 // gather a list of random nodes, skipping those of low quality
481 for (unsigned int n = 0; n < vRandom.size(); n++) {
482 if (vAddr.size() >= nNodes)
483 break;
484
485 int nRndPos = RandomInt(vRandom.size() - n) + n;
486 SwapRandom(n, nRndPos);
487 assert(mapInfo.count(vRandom[n]) == 1);
488
489 const CAddrInfo& ai = mapInfo[vRandom[n]];
490 if (!ai.IsTerrible())
491 vAddr.push_back(ai);
492 }
493}
494
495void CAddrMan::Connected_(const CService& addr, int64_t nTime)
496{

Callers

nothing calls this directly

Calls 4

IsTerribleMethod · 0.80
sizeMethod · 0.45
countMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected