| 2525 | } |
| 2526 | |
| 2527 | void PeerManagerImpl::ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv) |
| 2528 | { |
| 2529 | uint8_t filter_type_ser; |
| 2530 | uint256 stop_hash; |
| 2531 | |
| 2532 | vRecv >> filter_type_ser >> stop_hash; |
| 2533 | |
| 2534 | const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser); |
| 2535 | |
| 2536 | const CBlockIndex* stop_index; |
| 2537 | BlockFilterIndex* filter_index; |
| 2538 | if (!PrepareBlockFilterRequest(peer, filter_type, /*start_height=*/0, stop_hash, |
| 2539 | /*max_height_diff=*/std::numeric_limits<uint32_t>::max(), |
| 2540 | stop_index, filter_index)) { |
| 2541 | return; |
| 2542 | } |
| 2543 | |
| 2544 | std::vector<uint256> headers(stop_index->nHeight / CFCHECKPT_INTERVAL); |
| 2545 | |
| 2546 | // Populate headers. |
| 2547 | const CBlockIndex* block_index = stop_index; |
| 2548 | for (int i = headers.size() - 1; i >= 0; i--) { |
| 2549 | int height = (i + 1) * CFCHECKPT_INTERVAL; |
| 2550 | block_index = block_index->GetAncestor(height); |
| 2551 | |
| 2552 | if (!filter_index->LookupFilterHeader(block_index, headers[i])) { |
| 2553 | LogPrint(BCLog::NET, "Failed to find block filter header in index: filter_type=%s, block_hash=%s\n", |
| 2554 | BlockFilterTypeName(filter_type), block_index->GetBlockHash().ToString()); |
| 2555 | return; |
| 2556 | } |
| 2557 | } |
| 2558 | |
| 2559 | CSerializedNetMsg msg = CNetMsgMaker(peer.GetCommonVersion()) |
| 2560 | .Make(NetMsgType::CFCHECKPT, |
| 2561 | filter_type_ser, |
| 2562 | stop_index->GetBlockHash(), |
| 2563 | headers); |
| 2564 | m_connman.PushMessage(&peer, std::move(msg)); |
| 2565 | } |
| 2566 | |
| 2567 | void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlock>& block, bool force_processing) |
| 2568 | { |
nothing calls this directly
no test coverage detected