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 <common/messages.h>6#include <consensus/amount.h>7#include <policy/fees/block_policy_estimator.h>8#include <test/fuzz/FuzzedDataProvider.h>9#include <test/fuzz/fuzz.h>10#include <test/fuzz/util.h>11#include <util/fees.h>13#include <cstdint>14#include <string>15#include <vector>17using common::StringForFeeReason;19FUZZ_TARGET(fees)20{21FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());22const CFeeRate minimal_incremental_fee{ConsumeMoney(fuzzed_data_provider)};23FastRandomContext rng{/*fDeterministic=*/true};24FeeFilterRounder fee_filter_rounder{minimal_incremental_fee, rng};25LIMITED_WHILE (fuzzed_data_provider.ConsumeBool(), 10000) {26const CAmount current_minimum_fee = ConsumeMoney(fuzzed_data_provider);27const CAmount rounded_fee = fee_filter_rounder.round(current_minimum_fee);28assert(MoneyRange(rounded_fee));29}30const FeeReason fee_reason = fuzzed_data_provider.PickValueInArray({FeeReason::FEE_RATE_ESTIMATOR, FeeReason::MEMPOOL_MIN, FeeReason::USER_SPECIFIED, FeeReason::FALLBACK, FeeReason::REQUIRED});31(void)StringForFeeReason(fee_reason);32const BlockPolicyEstimateReason block_policy_fee_reason = fuzzed_data_provider.PickValueInArray({BlockPolicyEstimateReason::NONE, BlockPolicyEstimateReason::HALF_ESTIMATE, BlockPolicyEstimateReason::FULL_ESTIMATE, BlockPolicyEstimateReason::DOUBLE_ESTIMATE, BlockPolicyEstimateReason::CONSERVATIVE});33(void)StringForBlockPolicyEstimateReason(block_policy_fee_reason);34const FeeRateEstimatorType feerate_estimator_type = fuzzed_data_provider.PickValueInArray({FeeRateEstimatorType::AUTO, FeeRateEstimatorType::BLOCK_POLICY, FeeRateEstimatorType::MEMPOOL_POLICY});35(void)FeeRateEstimatorTypeToString(feerate_estimator_type);36(void)FeeRateEstimatorTypeFromString(fuzzed_data_provider.ConsumeRandomLengthString());37}
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.