26 static const auto testing_setup = MakeNoLogFileContext<>();
27 g_setup = testing_setup.get();
36 LIMITED_WHILE(good_data && fuzzed_data_provider.ConsumeBool(), 10
'000) 41 const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider, TX_WITH_WITNESS); 46 const CTransaction tx{*mtx}; 47 const CTxMemPoolEntry& entry = ConsumeTxMemPoolEntry(fuzzed_data_provider, tx); 48 const auto tx_submitted_in_package = fuzzed_data_provider.ConsumeBool(); 49 const auto tx_has_mempool_parents = fuzzed_data_provider.ConsumeBool(); 50 const auto tx_info = NewMempoolTransactionInfo(entry.GetSharedTx(), entry.GetFee(), 51 entry.GetTxSize(), entry.GetHeight(), 52 /*mempool_limit_bypassed=*/false, 53 tx_submitted_in_package, 54 /*chainstate_is_current=*/true, 55 tx_has_mempool_parents); 56 block_policy_estimator.processTransaction(tx_info); 57 if (fuzzed_data_provider.ConsumeBool()) { 58 (void)block_policy_estimator.removeTx(tx.GetHash()); 62 std::list<CTxMemPoolEntry> mempool_entries; 63 LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) 65 const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider, TX_WITH_WITNESS); 70 const CTransaction tx{*mtx}; 71 mempool_entries.emplace_back(CTxMemPoolEntry::ExplicitCopy, ConsumeTxMemPoolEntry(fuzzed_data_provider, tx)); 73 std::vector<RemovedMempoolTransactionInfo> txs; 74 txs.reserve(mempool_entries.size()); 75 for (const CTxMemPoolEntry& mempool_entry : mempool_entries) { 76 txs.emplace_back(mempool_entry); 78 block_policy_estimator.processBlock(txs, fuzzed_data_provider.ConsumeIntegral<unsigned int>()); 81 (void)block_policy_estimator.removeTx(ConsumeUInt256(fuzzed_data_provider)); 84 block_policy_estimator.FlushUnconfirmed(); 86 (void)block_policy_estimator.estimateFee(fuzzed_data_provider.ConsumeIntegral<int>()); 87 EstimationResult result; 88 auto conf_target = fuzzed_data_provider.ConsumeIntegral<int>(); 89 auto success_threshold = fuzzed_data_provider.ConsumeFloatingPoint<double>(); 90 auto horizon = fuzzed_data_provider.PickValueInArray(ALL_FEE_ESTIMATE_HORIZONS); 91 auto* result_ptr = fuzzed_data_provider.ConsumeBool() ? &result : nullptr; 92 (void)block_policy_estimator.estimateRawFee(conf_target, success_threshold, horizon, result_ptr); 94 FeeCalculation fee_calculation; 95 conf_target = fuzzed_data_provider.ConsumeIntegral<int>(); 96 auto* fee_calc_ptr = fuzzed_data_provider.ConsumeBool() ? &fee_calculation : nullptr; 97 auto conservative = fuzzed_data_provider.ConsumeBool(); 98 (void)block_policy_estimator.estimateSmartFee(conf_target, fee_calc_ptr, conservative); 100 (void)block_policy_estimator.HighestTargetTracked(fuzzed_data_provider.PickValueInArray(ALL_FEE_ESTIMATE_HORIZONS)); 103 FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider}; 104 AutoFile fuzzed_auto_file{fuzzed_file_provider.open()}; 105 block_policy_estimator.Write(fuzzed_auto_file); 106 block_policy_estimator.Read(fuzzed_auto_file); fs::path FeeestPath(const ArgsManager &argsman)
static constexpr bool DEFAULT_ACCEPT_STALE_FEE_ESTIMATES
FUZZ_TARGET(policy_estimator,.init=initialize_policy_estimator)
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
void initialize_policy_estimator()