Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2020-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <blockfilter.h>6#include <test/fuzz/FuzzedDataProvider.h>7#include <test/fuzz/fuzz.h>8#include <test/fuzz/util.h>9#include <test/util/random.h>11#include <cstdint>12#include <optional>13#include <string>14#include <vector>16FUZZ_TARGET(blockfilter)17{18SeedRandomStateForTest(SeedRand::ZEROS);19FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());20const std::optional<BlockFilter> block_filter = ConsumeDeserializable<BlockFilter>(fuzzed_data_provider);21if (!block_filter) {22return;23}24{25(void)block_filter->ComputeHeader(ConsumeUInt256(fuzzed_data_provider));26(void)block_filter->GetBlockHash();27(void)block_filter->GetEncodedFilter();28(void)block_filter->GetHash();29}30{31const BlockFilterType block_filter_type = block_filter->GetFilterType();32(void)BlockFilterTypeName(block_filter_type);33}34{35const GCSFilter gcs_filter = block_filter->GetFilter();36(void)gcs_filter.GetN();37(void)gcs_filter.GetParams();38(void)gcs_filter.GetEncoded();39(void)gcs_filter.Match(ConsumeRandomLengthByteVector(fuzzed_data_provider));40GCSFilter::ElementSet element_set;41LIMITED_WHILE (fuzzed_data_provider.ConsumeBool(), 30000) {42element_set.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider));43}44gcs_filter.MatchAny(element_set);45}46}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.