LCOV - code coverage report
Current view: top level - src/test/fuzz - fees.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 17 17
Test Date: 2026-08-29 05:53:03 Functions: 100.0 % 2 2
Branches: 58.3 % 24 14

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2020-present The Bitcoin Core developers
       2                 :             : // Distributed under the MIT software license, see the accompanying
       3                 :             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :             : 
       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>
      12                 :             : 
      13                 :             : #include <cstdint>
      14                 :             : #include <string>
      15                 :             : #include <vector>
      16                 :             : 
      17                 :             : using common::StringForFeeReason;
      18                 :             : 
      19         [ +  - ]:         662 : FUZZ_TARGET(fees)
      20                 :             : {
      21                 :         186 :     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      22                 :         186 :     const CFeeRate minimal_incremental_fee{ConsumeMoney(fuzzed_data_provider)};
      23                 :         186 :     FastRandomContext rng{/*fDeterministic=*/true};
      24         [ +  - ]:         186 :     FeeFilterRounder fee_filter_rounder{minimal_incremental_fee, rng};
      25   [ +  +  +  + ]:      277614 :     LIMITED_WHILE (fuzzed_data_provider.ConsumeBool(), 10000) {
      26                 :      277428 :         const CAmount current_minimum_fee = ConsumeMoney(fuzzed_data_provider);
      27         [ +  - ]:      277428 :         const CAmount rounded_fee = fee_filter_rounder.round(current_minimum_fee);
      28         [ -  + ]:      277428 :         assert(MoneyRange(rounded_fee));
      29                 :             :     }
      30                 :         186 :     const FeeReason fee_reason = fuzzed_data_provider.PickValueInArray({FeeReason::FEE_RATE_ESTIMATOR, FeeReason::MEMPOOL_MIN, FeeReason::USER_SPECIFIED, FeeReason::FALLBACK, FeeReason::REQUIRED});
      31         [ +  - ]:         186 :     (void)StringForFeeReason(fee_reason);
      32                 :         186 :     const BlockPolicyEstimateReason block_policy_fee_reason = fuzzed_data_provider.PickValueInArray({BlockPolicyEstimateReason::NONE, BlockPolicyEstimateReason::HALF_ESTIMATE, BlockPolicyEstimateReason::FULL_ESTIMATE, BlockPolicyEstimateReason::DOUBLE_ESTIMATE, BlockPolicyEstimateReason::CONSERVATIVE});
      33         [ +  - ]:         186 :     (void)StringForBlockPolicyEstimateReason(block_policy_fee_reason);
      34                 :         186 :     const FeeRateEstimatorType feerate_estimator_type = fuzzed_data_provider.PickValueInArray({FeeRateEstimatorType::NONE, FeeRateEstimatorType::BLOCK_POLICY, FeeRateEstimatorType::MEMPOOL_POLICY});
      35         [ +  - ]:         186 :     (void)FeeRateEstimatorTypeToString(feerate_estimator_type);
      36   [ +  -  -  +  :         372 :     (void)FeeRateEstimatorTypeFromString(fuzzed_data_provider.ConsumeRandomLengthString());
                   +  - ]
      37                 :         186 : }
        

Generated by: LCOV version 2.5.0-full