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

Method ProcessGetCFilters

src/net_processing.cpp:2452–2481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2450}
2451
2452void PeerManagerImpl::ProcessGetCFilters(CNode& peer, CDataStream& vRecv)
2453{
2454 uint8_t filter_type_ser;
2455 uint32_t start_height;
2456 uint256 stop_hash;
2457
2458 vRecv >> filter_type_ser >> start_height >> stop_hash;
2459
2460 const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);
2461
2462 const CBlockIndex* stop_index;
2463 BlockFilterIndex* filter_index;
2464 if (!PrepareBlockFilterRequest(peer, filter_type, start_height, stop_hash,
2465 MAX_GETCFILTERS_SIZE, stop_index, filter_index)) {
2466 return;
2467 }
2468
2469 std::vector<BlockFilter> filters;
2470 if (!filter_index->LookupFilterRange(start_height, stop_index, filters)) {
2471 LogPrint(BCLog::NET, "Failed to find block filter in index: filter_type=%s, start_height=%d, stop_hash=%s\n",
2472 BlockFilterTypeName(filter_type), start_height, stop_hash.ToString());
2473 return;
2474 }
2475
2476 for (const auto& filter : filters) {
2477 CSerializedNetMsg msg = CNetMsgMaker(peer.GetCommonVersion())
2478 .Make(NetMsgType::CFILTER, filter);
2479 m_connman.PushMessage(&peer, std::move(msg));
2480 }
2481}
2482
2483void PeerManagerImpl::ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv)
2484{

Callers

nothing calls this directly

Calls 6

CNetMsgMakerClass · 0.85
LookupFilterRangeMethod · 0.80
GetCommonVersionMethod · 0.80
PushMessageMethod · 0.80
ToStringMethod · 0.45
MakeMethod · 0.45

Tested by

no test coverage detected