Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
fees.cpp
Go to the documentation of this file.
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>
9#include <test/fuzz/fuzz.h>
10#include <test/fuzz/util.h>
11
12#include <cstdint>
13#include <string>
14#include <vector>
15
17
19{
20 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
21 const CFeeRate minimal_incremental_fee{ConsumeMoney(fuzzed_data_provider)};
22 FastRandomContext rng{/*fDeterministic=*/true};
23 FeeFilterRounder fee_filter_rounder{minimal_incremental_fee, rng};
24 LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
25 const CAmount current_minimum_fee = ConsumeMoney(fuzzed_data_provider);
26 const CAmount rounded_fee = fee_filter_rounder.round(current_minimum_fee);
27 assert(MoneyRange(rounded_fee));
28 }
30 (void)StringForFeeReason(fee_reason);
31}
bool MoneyRange(const CAmount &nValue)
Definition amount.h:27
int64_t CAmount
Amount in satoshis (Can be negative).
Definition amount.h:12
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.
Definition feerate.h:32
Fast randomness source.
Definition random.h:386
CAmount round(CAmount currentMinFee) EXCLUSIVE_LOCKS_REQUIRED(!m_insecure_rand_mutex)
Quantize a minimum fee for privacy purpose before broadcast.
T PickValueInArray(const T(&array)[size])
#define FUZZ_TARGET(...)
Definition fuzz.h:35
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
Definition fuzz.h:22
std::string StringForFeeReason(FeeReason reason)
Definition messages.cpp:27
std::string StringForFeeReason(FeeReason reason)
Definition messages.cpp:27
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
Definition util.cpp:29
assert(!tx.IsCoinBase())