Bitcoin Core  22.99.0
P2P Digital Currency
fees.cpp
Go to the documentation of this file.
1 // Copyright (c) 2020 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 <amount.h>
6 #include <policy/fees.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 
17 {
18  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
19  const CFeeRate minimal_incremental_fee{ConsumeMoney(fuzzed_data_provider)};
20  FeeFilterRounder fee_filter_rounder{minimal_incremental_fee};
21  while (fuzzed_data_provider.ConsumeBool()) {
22  const CAmount current_minimum_fee = ConsumeMoney(fuzzed_data_provider);
23  const CAmount rounded_fee = fee_filter_rounder.round(current_minimum_fee);
24  assert(MoneyRange(rounded_fee));
25  }
27  (void)StringForFeeReason(fee_reason);
28 }
FeeReason
FeeReason
Definition: fees.h:43
assert
assert(!tx.IsCoinBase())
util.h
FuzzedDataProvider::PickValueInArray
T PickValueInArray(const T(&array)[size])
Definition: FuzzedDataProvider.h:303
MoneyRange
bool MoneyRange(const CAmount &nValue)
Definition: amount.h:26
FeeReason::FULL_ESTIMATE
@ FULL_ESTIMATE
FeeReason::PAYTXFEE
@ PAYTXFEE
FeeReason::NONE
@ NONE
CFeeRate
Fee rate in satoshis per kilobyte: CAmount / kB.
Definition: feerate.h:29
FeeReason::FALLBACK
@ FALLBACK
FeeReason::MEMPOOL_MIN
@ MEMPOOL_MIN
FuzzedDataProvider.h
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
FeeFilterRounder
Definition: fees.h:272
FeeReason::REQUIRED
@ REQUIRED
fees.h
fees.h
fuzz.h
FuzzedDataProvider
Definition: FuzzedDataProvider.h:31
FeeReason::DOUBLE_ESTIMATE
@ DOUBLE_ESTIMATE
FUZZ_TARGET
FUZZ_TARGET(fees)
Definition: fees.cpp:16
FeeReason::HALF_ESTIMATE
@ HALF_ESTIMATE
StringForFeeReason
std::string StringForFeeReason(FeeReason reason)
Definition: fees.cpp:17
FuzzedDataProvider::ConsumeBool
bool ConsumeBool()
Definition: FuzzedDataProvider.h:288
ConsumeMoney
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
Definition: util.cpp:221
amount.h
FeeReason::CONSERVATIVE
@ CONSERVATIVE