10 #include <validation.h> 24 ~FeeEstimatorTestingSetup() {
28 void SetFeeEstimator(std::unique_ptr<CBlockPolicyEstimator> fee_estimator)
34 FeeEstimatorTestingSetup*
g_setup;
55 void initialize_setup()
57 static const auto testing_setup = MakeNoLogFileContext<FeeEstimatorTestingSetup>();
75 node.mempool = std::make_unique<CTxMemPool>(mempool_opts, error);
76 std::unique_ptr<CBlockPolicyEstimator> fee_estimator = std::make_unique<FuzzedBlockPolicyEstimator>(
fuzzed_data_provider);
77 g_setup->SetFeeEstimator(std::move(fee_estimator));
79 if (target_feerate >
node.mempool->m_opts.incremental_relay_feerate &&
80 target_feerate >
node.mempool->m_opts.min_relay_feerate) {
84 CWallet&
wallet{*wallet_ptr};
107 CCoinControl coin_control;
114 if (fuzzed_data_provider.ConsumeBool()) { 115 coin_control.m_fee_mode = fuzzed_data_provider.ConsumeBool() ? FeeEstimateMode::CONSERVATIVE : FeeEstimateMode::ECONOMICAL; 118 FeeCalculation fee_calculation; 119 FeeCalculation* maybe_fee_calculation{fuzzed_data_provider.ConsumeBool() ? nullptr : &fee_calculation}; 120 (void)GetMinimumFeeRate(wallet, coin_control, maybe_fee_calculation); 121 (void)GetMinimumFee(wallet, tx_bytes, coin_control, maybe_fee_calculation); 124 } // namespace wallet void MockMempoolMinFee(const CFeeRate &target_feerate, CTxMemPool &mempool)
Mock the mempool minimum feerate by adding a transaction and calling TrimToSize(0), simulating the mempool "reaching capacity" and evicting by descendant feerate.
FUZZ_TARGET(coin_grinder)
int Height() const
Return the maximal height in the chain.
CFeeRate GetDiscardRate(const CWallet &wallet)
Return the maximum feerate for discarding change.
const TestingSetup * g_setup
CChain m_chain
The current chain of blockheaders we consult and build on.
CFeeRate GetRequiredFeeRate(const CWallet &wallet)
Return the minimum required feerate taking into account the minimum relay feerate and user set minimu...
uint256 GetBlockHash() const
std::unique_ptr< CBlockPolicyEstimator > fee_estimator
Chainstate stores and provides an API to update our local knowledge of the current best chain...
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
FeePerVSize m_feerate
Fee rate in sats/vB (satoshis per N virtualbytes)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase(MockableData records)
FuzzedDataProvider & fuzzed_data_provider
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac...
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
CAmount GetRequiredFee(const CWallet &wallet, unsigned int nTxBytes)
Return the minimum required absolute fee for this size based on the required fee rate.
Options struct containing options for constructing a CTxMemPool.
T ConsumeIntegralInRange(T min, T max)
Seed with a compile time constant of zeros.
Testing setup that configures a complete environment.
CFeeRate incremental_relay_feerate
static constexpr CAmount COIN
The amount of satoshis in one BTC.