MCPcopy Create free account
hub / github.com/ElementsProject/elements / SendBlockTransactions

Method SendBlockTransactions

src/net_processing.cpp:2069–2083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2067}
2068
2069void PeerManagerImpl::SendBlockTransactions(CNode& pfrom, const CBlock& block, const BlockTransactionsRequest& req)
2070{
2071 BlockTransactions resp(req);
2072 for (size_t i = 0; i < req.indexes.size(); i++) {
2073 if (req.indexes[i] >= block.vtx.size()) {
2074 Misbehaving(pfrom.GetId(), 100, "getblocktxn with out-of-bounds tx indices");
2075 return;
2076 }
2077 resp.txn[i] = block.vtx[req.indexes[i]];
2078 }
2079 LOCK(cs_main);
2080 const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
2081 int nSendFlags = State(pfrom.GetId())->fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
2082 m_connman.PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::BLOCKTXN, resp));
2083}
2084
2085void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
2086 const std::vector<CBlockHeader>& headers,

Callers

nothing calls this directly

Calls 6

GetIdMethod · 0.80
GetCommonVersionMethod · 0.80
PushMessageMethod · 0.80
StateEnum · 0.70
sizeMethod · 0.45
MakeMethod · 0.45

Tested by

no test coverage detected