| 2626 | } |
| 2627 | |
| 2628 | void 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 | |
| 2647 | bool PeerManagerImpl::CheckHeadersPoW(const std::vector<CBlockHeader>& headers, Peer& peer) |
| 2648 | { |
nothing calls this directly
no test coverage detected