MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / PushAddress

Method PushAddress

src/net_processing.cpp:1139–1152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1137}
1138
1139void PeerManagerImpl::PushAddress(Peer& peer, const CAddress& addr)
1140{
1141 // Known checking here is only to save space from duplicates.
1142 // Before sending, we'll filter it again for known addresses that were
1143 // added after addresses were pushed.
1144 assert(peer.m_addr_known);
1145 if (addr.IsValid() && !peer.m_addr_known->contains(addr.GetKey()) && IsAddrCompatible(peer, addr)) {
1146 if (peer.m_addrs_to_send.size() >= MAX_ADDR_TO_SEND) {
1147 peer.m_addrs_to_send[m_rng.randrange(peer.m_addrs_to_send.size())] = addr;
1148 } else {
1149 peer.m_addrs_to_send.push_back(addr);
1150 }
1151 }
1152}
1153
1154static void AddKnownTx(Peer& peer, const uint256& hash)
1155{

Callers

nothing calls this directly

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