MCPcopy Create free account
hub / github.com/ElementsProject/elements / PushAddress

Function PushAddress

src/net_processing.cpp:814–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814static void PushAddress(Peer& peer, const CAddress& addr, FastRandomContext& insecure_rand)
815{
816 // Known checking here is only to save space from duplicates.
817 // Before sending, we'll filter it again for known addresses that were
818 // added after addresses were pushed.
819 assert(peer.m_addr_known);
820 if (addr.IsValid() && !peer.m_addr_known->contains(addr.GetKey()) && IsAddrCompatible(peer, addr)) {
821 if (peer.m_addrs_to_send.size() >= MAX_ADDR_TO_SEND) {
822 peer.m_addrs_to_send[insecure_rand.randrange(peer.m_addrs_to_send.size())] = addr;
823 } else {
824 peer.m_addrs_to_send.push_back(addr);
825 }
826 }
827}
828
829static void UpdatePreferredDownload(const CNode& node, CNodeState* state) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
830{

Callers 3

RelayAddressMethod · 0.85
ProcessMessageMethod · 0.85
MaybeSendAddrMethod · 0.85

Calls 7

IsAddrCompatibleFunction · 0.85
randrangeMethod · 0.80
IsValidMethod · 0.45
containsMethod · 0.45
GetKeyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected