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

Method SendBlockTransactions

src/net_processing.cpp:2628–2645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2626}
2627
2628void PeerManagerImpl::SendBlockTransactions(CNode& pfrom, Peer& peer, const CBlock& block, const BlockTransactionsRequest& req)
2629{
2630 BlockTransactions resp(req);
2631 for (size_t i = 0; i < req.indexes.size(); i++) {
2632 if (req.indexes[i] >= block.vtx.size()) {
2633 Misbehaving(peer, "getblocktxn with out-of-bounds tx indices");
2634 return;
2635 }
2636 resp.txn[i] = block.vtx[req.indexes[i]];
2637 }
2638
2639 if (util::log::ShouldDebugLog(BCLog::CMPCTBLOCK)) {
2640 uint32_t tx_requested_size{0};
2641 for (const auto& tx : resp.txn) tx_requested_size += tx->ComputeTotalSize();
2642 LogDebug(BCLog::CMPCTBLOCK, "%s sent us a GETBLOCKTXN for block %s, sending a BLOCKTXN with %u txns. (%u bytes)", pfrom.LogPeer(), block.GetHash().ToString(), resp.txn.size(), tx_requested_size);
2643 }
2644 MakeAndPushMessage(pfrom, NetMsgType::BLOCKTXN, resp);
2645}
2646
2647bool PeerManagerImpl::CheckHeadersPoW(const std::vector<CBlockHeader>& headers, Peer& peer)
2648{

Callers

nothing calls this directly

Calls 5

ComputeTotalSizeMethod · 0.80
LogPeerMethod · 0.80
sizeMethod · 0.45
ToStringMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected