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

Method ProcessGetCFCheckPt

src/net_processing.cpp:3417–3453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3415}
3416
3417void PeerManagerImpl::ProcessGetCFCheckPt(CNode& node, Peer& peer, DataStream& vRecv)
3418{
3419 uint8_t filter_type_ser;
3420 uint256 stop_hash;
3421
3422 vRecv >> filter_type_ser >> stop_hash;
3423
3424 const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);
3425
3426 const CBlockIndex* stop_index;
3427 BlockFilterIndex* filter_index;
3428 if (!PrepareBlockFilterRequest(node, peer, filter_type, /*start_height=*/0, stop_hash,
3429 /*max_height_diff=*/std::numeric_limits<uint32_t>::max(),
3430 stop_index, filter_index)) {
3431 return;
3432 }
3433
3434 std::vector<uint256> headers(stop_index->nHeight / CFCHECKPT_INTERVAL);
3435
3436 // Populate headers.
3437 const CBlockIndex* block_index = stop_index;
3438 for (int i = headers.size() - 1; i >= 0; i--) {
3439 int height = (i + 1) * CFCHECKPT_INTERVAL;
3440 block_index = block_index->GetAncestor(height);
3441
3442 if (!filter_index->LookupFilterHeader(block_index, headers[i])) {
3443 LogDebug(BCLog::NET, "Failed to find block filter header in index: filter_type=%s, block_hash=%s\n",
3444 BlockFilterTypeName(filter_type), block_index->GetBlockHash().ToString());
3445 return;
3446 }
3447 }
3448
3449 MakeAndPushMessage(node, NetMsgType::CFCHECKPT,
3450 filter_type_ser,
3451 stop_index->GetBlockHash(),
3452 headers);
3453}
3454
3455void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlock>& block, bool force_processing, bool min_pow_checked)
3456{

Callers

nothing calls this directly

Calls 5

LookupFilterHeaderMethod · 0.80
sizeMethod · 0.45
GetAncestorMethod · 0.45
ToStringMethod · 0.45
GetBlockHashMethod · 0.45

Tested by

no test coverage detected