14 #include <txmempool.h> 27 static const auto testing_setup = MakeNoLogFileContext<>();
28 g_setup = testing_setup.get();
39 const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider);
44 block_policy_estimator.processTransaction(
ConsumeTxMemPoolEntry(fuzzed_data_provider, tx), fuzzed_data_provider.ConsumeBool());
45 if (fuzzed_data_provider.ConsumeBool()) {
46 (void)block_policy_estimator.removeTx(tx.GetHash(), fuzzed_data_provider.ConsumeBool());
50 std::vector<CTxMemPoolEntry> mempool_entries;
52 const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider);
59 std::vector<const CTxMemPoolEntry*> ptrs;
60 ptrs.reserve(mempool_entries.size());
62 ptrs.push_back(&mempool_entry);
64 block_policy_estimator.processBlock(fuzzed_data_provider.ConsumeIntegral<
unsigned int>(), ptrs);
67 (void)block_policy_estimator.removeTx(
ConsumeUInt256(fuzzed_data_provider), fuzzed_data_provider.ConsumeBool());
70 block_policy_estimator.FlushUnconfirmed();
72 (void)block_policy_estimator.estimateFee(fuzzed_data_provider.ConsumeIntegral<
int>());
74 (void)block_policy_estimator.estimateRawFee(fuzzed_data_provider.ConsumeIntegral<
int>(), fuzzed_data_provider.ConsumeFloatingPoint<
double>(), fuzzed_data_provider.PickValueInArray(
ALL_FEE_ESTIMATE_HORIZONS), fuzzed_data_provider.ConsumeBool() ? &result :
nullptr);
76 (void)block_policy_estimator.estimateSmartFee(fuzzed_data_provider.ConsumeIntegral<
int>(), fuzzed_data_provider.ConsumeBool() ? &fee_calculation :
nullptr, fuzzed_data_provider.ConsumeBool());
81 AutoFile fuzzed_auto_file{fuzzed_auto_file_provider.
open()};
82 block_policy_estimator.Write(fuzzed_auto_file);
83 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.
Non-refcounted RAII wrapper for FILE*.
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
FuzzedAutoFileProvider ConsumeAutoFile(FuzzedDataProvider &fuzzed_data_provider) noexcept
CTxMemPoolEntry ConsumeTxMemPoolEntry(FuzzedDataProvider &fuzzed_data_provider, const CTransaction &tx) noexcept
static constexpr auto ALL_FEE_ESTIMATE_HORIZONS
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
The basic transaction that is broadcasted on the network and contained in blocks. ...
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
void initialize_policy_estimator()