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

Method PushPrivateBroadcastTx

src/net_processing.cpp:3584–3601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3582}
3583
3584void PeerManagerImpl::PushPrivateBroadcastTx(CNode& node)
3585{
3586 Assume(node.IsPrivateBroadcastConn());
3587
3588 const auto opt_tx{m_tx_for_private_broadcast.PickTxForSend(node.GetId(), CService{node.addr})};
3589 if (!opt_tx) {
3590 LogDebug(BCLog::PRIVBROADCAST, "Disconnecting: no more transactions for private broadcast (connected in vain), %s", node.LogPeer());
3591 node.fDisconnect = true;
3592 return;
3593 }
3594 const CTransactionRef& tx{*opt_tx};
3595
3596 LogDebug(BCLog::PRIVBROADCAST, "P2P handshake completed, sending INV for txid=%s%s, %s",
3597 tx->GetHash().ToString(), tx->HasWitness() ? strprintf(", wtxid=%s", tx->GetWitnessHash().ToString()) : "",
3598 node.LogPeer());
3599
3600 MakeAndPushMessage(node, NetMsgType::INV, std::vector<CInv>{{CInv{MSG_TX, tx->GetHash().ToUint256()}}});
3601}
3602
3603void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string& msg_type, DataStream& vRecv,
3604 const NodeClock::time_point time_received,

Callers

nothing calls this directly

Calls 6

GetIdMethod · 0.80
LogPeerMethod · 0.80
ToStringMethod · 0.45
GetHashMethod · 0.45
HasWitnessMethod · 0.45

Tested by

no test coverage detected