MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / ProcessGetCFHeaders

Method ProcessGetCFHeaders

src/net_processing.cpp:4613–4659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4611}
4612
4613void PeerManagerImpl::ProcessGetCFHeaders(CNode &node, Peer &peer,
4614 DataStream &vRecv) {
4615 uint8_t filter_type_ser;
4616 uint32_t start_height;
4617 BlockHash stop_hash;
4618
4619 vRecv >> filter_type_ser >> start_height >> stop_hash;
4620
4621 const BlockFilterType filter_type =
4622 static_cast<BlockFilterType>(filter_type_ser);
4623
4624 const CBlockIndex *stop_index;
4625 BlockFilterIndex *filter_index;
4626 if (!PrepareBlockFilterRequest(node, peer, filter_type, start_height,
4627 stop_hash, MAX_GETCFHEADERS_SIZE, stop_index,
4628 filter_index)) {
4629 return;
4630 }
4631
4632 uint256 prev_header;
4633 if (start_height > 0) {
4634 const CBlockIndex *const prev_block =
4635 stop_index->GetAncestor(static_cast<int>(start_height - 1));
4636 if (!filter_index->LookupFilterHeader(prev_block, prev_header)) {
4637 LogPrint(BCLog::NET,
4638 "Failed to find block filter header in index: "
4639 "filter_type=%s, block_hash=%s\n",
4640 BlockFilterTypeName(filter_type),
4641 prev_block->GetBlockHash().ToString());
4642 return;
4643 }
4644 }
4645
4646 std::vector<uint256> filter_hashes;
4647 if (!filter_index->LookupFilterHashRange(start_height, stop_index,
4648 filter_hashes)) {
4649 LogPrint(BCLog::NET,
4650 "Failed to find block filter hashes in index: filter_type=%s, "
4651 "start_height=%d, stop_hash=%s\n",
4652 BlockFilterTypeName(filter_type), start_height,
4653 stop_hash.ToString());
4654 return;
4655 }
4656
4657 MakeAndPushMessage(node, NetMsgType::CFHEADERS, filter_type_ser,
4658 stop_index->GetBlockHash(), prev_header, filter_hashes);
4659}
4660
4661void PeerManagerImpl::ProcessGetCFCheckPt(CNode &node, Peer &peer,
4662 DataStream &vRecv) {

Callers

nothing calls this directly

Calls 5

GetAncestorMethod · 0.80
LookupFilterHeaderMethod · 0.80
LookupFilterHashRangeMethod · 0.80
ToStringMethod · 0.45
GetBlockHashMethod · 0.45

Tested by

no test coverage detected