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

Method ProcessGetCFHeaders

src/net_processing.cpp:2483–2525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2481}
2482
2483void PeerManagerImpl::ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv)
2484{
2485 uint8_t filter_type_ser;
2486 uint32_t start_height;
2487 uint256 stop_hash;
2488
2489 vRecv >> filter_type_ser >> start_height >> stop_hash;
2490
2491 const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);
2492
2493 const CBlockIndex* stop_index;
2494 BlockFilterIndex* filter_index;
2495 if (!PrepareBlockFilterRequest(peer, filter_type, start_height, stop_hash,
2496 MAX_GETCFHEADERS_SIZE, stop_index, filter_index)) {
2497 return;
2498 }
2499
2500 uint256 prev_header;
2501 if (start_height > 0) {
2502 const CBlockIndex* const prev_block =
2503 stop_index->GetAncestor(static_cast<int>(start_height - 1));
2504 if (!filter_index->LookupFilterHeader(prev_block, prev_header)) {
2505 LogPrint(BCLog::NET, "Failed to find block filter header in index: filter_type=%s, block_hash=%s\n",
2506 BlockFilterTypeName(filter_type), prev_block->GetBlockHash().ToString());
2507 return;
2508 }
2509 }
2510
2511 std::vector<uint256> filter_hashes;
2512 if (!filter_index->LookupFilterHashRange(start_height, stop_index, filter_hashes)) {
2513 LogPrint(BCLog::NET, "Failed to find block filter hashes in index: filter_type=%s, start_height=%d, stop_hash=%s\n",
2514 BlockFilterTypeName(filter_type), start_height, stop_hash.ToString());
2515 return;
2516 }
2517
2518 CSerializedNetMsg msg = CNetMsgMaker(peer.GetCommonVersion())
2519 .Make(NetMsgType::CFHEADERS,
2520 filter_type_ser,
2521 stop_index->GetBlockHash(),
2522 prev_header,
2523 filter_hashes);
2524 m_connman.PushMessage(&peer, std::move(msg));
2525}
2526
2527void PeerManagerImpl::ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv)
2528{

Callers

nothing calls this directly

Calls 9

CNetMsgMakerClass · 0.85
GetAncestorMethod · 0.80
LookupFilterHeaderMethod · 0.80
LookupFilterHashRangeMethod · 0.80
GetCommonVersionMethod · 0.80
PushMessageMethod · 0.80
ToStringMethod · 0.45
GetBlockHashMethod · 0.45
MakeMethod · 0.45

Tested by

no test coverage detected