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

Method InitiateTxBroadcastToAll

src/net_processing.cpp:2272–2294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2270}
2271
2272void PeerManagerImpl::InitiateTxBroadcastToAll(const Txid& txid, const Wtxid& wtxid)
2273{
2274 for (const PeerRef& peer_ref : GetAllPeers()) {
2275 if (!peer_ref) continue;
2276 Peer& peer{*peer_ref};
2277
2278 auto tx_relay = peer.GetTxRelay();
2279 if (!tx_relay) continue;
2280
2281 LOCK(tx_relay->m_tx_inventory_mutex);
2282 // Only queue transactions for announcement once the version handshake
2283 // is completed. The time of arrival for these transactions is
2284 // otherwise at risk of leaking to a spy, if the spy is able to
2285 // distinguish transactions received during the handshake from the rest
2286 // in the announcement.
2287 if (tx_relay->m_next_inv_send_time == 0s) continue;
2288
2289 const uint256& hash{peer.m_wtxid_relay ? wtxid.ToUint256() : txid.ToUint256()};
2290 if (!tx_relay->m_tx_inventory_known_filter.contains(hash)) {
2291 tx_relay->m_tx_inventory_to_send.insert(wtxid);
2292 }
2293 }
2294}
2295
2296void PeerManagerImpl::InitiateTxBroadcastPrivate(const CTransactionRef& tx)
2297{

Callers 1

BroadcastTransactionFunction · 0.80

Calls 2

containsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected