Branch data Line data Source code
1 : : // Copyright (c) 2020-2021 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 <consensus/amount.h> 6 : : #include <policy/fees.h> 7 : : #include <test/fuzz/FuzzedDataProvider.h> 8 : : #include <test/fuzz/fuzz.h> 9 : : #include <test/fuzz/util.h> 10 : : #include <util/fees.h> 11 : : 12 : : #include <cstdint> 13 : : #include <string> 14 : : #include <vector> 15 : : 16 [ - + ]: 404 : FUZZ_TARGET(fees) 17 [ + - ]: 173 : { 18 [ + - ]: 231 : FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); 19 : 58 : const CFeeRate minimal_incremental_fee{ConsumeMoney(fuzzed_data_provider)}; 20 : 58 : FeeFilterRounder fee_filter_rounder{minimal_incremental_fee}; 21 [ + - + + : 2401 : LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) { + + ] 22 : 2343 : const CAmount current_minimum_fee = ConsumeMoney(fuzzed_data_provider); 23 [ + - ]: 2343 : const CAmount rounded_fee = fee_filter_rounder.round(current_minimum_fee); 24 [ + - - + ]: 2343 : assert(MoneyRange(rounded_fee)); 25 [ + - ]: 2516 : } 26 [ + - ]: 58 : const FeeReason fee_reason = fuzzed_data_provider.PickValueInArray({FeeReason::NONE, FeeReason::HALF_ESTIMATE, FeeReason::FULL_ESTIMATE, FeeReason::DOUBLE_ESTIMATE, FeeReason::CONSERVATIVE, FeeReason::MEMPOOL_MIN, FeeReason::PAYTXFEE, FeeReason::FALLBACK, FeeReason::REQUIRED}); 27 [ + - ]: 58 : (void)StringForFeeReason(fee_reason); 28 : 58 : }