| 3373 | } |
| 3374 | |
| 3375 | void PeerManagerImpl::ProcessGetCFHeaders(CNode& node, Peer& peer, DataStream& vRecv) |
| 3376 | { |
| 3377 | uint8_t filter_type_ser; |
| 3378 | uint32_t start_height; |
| 3379 | uint256 stop_hash; |
| 3380 | |
| 3381 | vRecv >> filter_type_ser >> start_height >> stop_hash; |
| 3382 | |
| 3383 | const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser); |
| 3384 | |
| 3385 | const CBlockIndex* stop_index; |
| 3386 | BlockFilterIndex* filter_index; |
| 3387 | if (!PrepareBlockFilterRequest(node, peer, filter_type, start_height, stop_hash, |
| 3388 | MAX_GETCFHEADERS_SIZE, stop_index, filter_index)) { |
| 3389 | return; |
| 3390 | } |
| 3391 | |
| 3392 | uint256 prev_header; |
| 3393 | if (start_height > 0) { |
| 3394 | const CBlockIndex* const prev_block = |
| 3395 | stop_index->GetAncestor(static_cast<int>(start_height - 1)); |
| 3396 | if (!filter_index->LookupFilterHeader(prev_block, prev_header)) { |
| 3397 | LogDebug(BCLog::NET, "Failed to find block filter header in index: filter_type=%s, block_hash=%s\n", |
| 3398 | BlockFilterTypeName(filter_type), prev_block->GetBlockHash().ToString()); |
| 3399 | return; |
| 3400 | } |
| 3401 | } |
| 3402 | |
| 3403 | std::vector<uint256> filter_hashes; |
| 3404 | if (!filter_index->LookupFilterHashRange(start_height, stop_index, filter_hashes)) { |
| 3405 | LogDebug(BCLog::NET, "Failed to find block filter hashes in index: filter_type=%s, start_height=%d, stop_hash=%s\n", |
| 3406 | BlockFilterTypeName(filter_type), start_height, stop_hash.ToString()); |
| 3407 | return; |
| 3408 | } |
| 3409 | |
| 3410 | MakeAndPushMessage(node, NetMsgType::CFHEADERS, |
| 3411 | filter_type_ser, |
| 3412 | stop_index->GetBlockHash(), |
| 3413 | prev_header, |
| 3414 | filter_hashes); |
| 3415 | } |
| 3416 | |
| 3417 | void PeerManagerImpl::ProcessGetCFCheckPt(CNode& node, Peer& peer, DataStream& vRecv) |
| 3418 | { |
nothing calls this directly
no test coverage detected