71 const int32_t chunk_size{10};
73 const FeePerVSize super_high_fee_rate{500 * individual_tx_vsize, individual_tx_vsize};
74 const FeePerVSize high_fee_rate{100 * individual_tx_vsize, individual_tx_vsize};
75 const FeePerVSize medium_fee_rate{50 * individual_tx_vsize, individual_tx_vsize};
76 const FeePerVSize low_fee_rate{10 * individual_tx_vsize, individual_tx_vsize};
77 std::vector<FeePerVSize> chunk_feerates;
78 chunk_feerates.reserve(chunk_size);
79 for (
int i = 0; i < chunk_size; ++i) {
81 chunk_feerates.emplace_back(super_high_fee_rate);
83 chunk_feerates.emplace_back(high_fee_rate);
85 chunk_feerates.emplace_back(medium_fee_rate);
95 chunk_feerates.emplace_back(low_fee_rate);
137 const std::string unloaded_err =
strprintf(
"%s: Mempool not loaded yet, no fee rate estimate available",
139 const auto result = mempool_estimator.EstimateFeeRate(
true);
143 m_node.mempool->SetLoadTried(
true);
145 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
148 const auto result = mempool_estimator.EstimateFeeRate(
true);
149 const std::string insufficient_err{
strprintf(
"%s: Not enough recent block data for fee rate estimation",
157 unsigned int custom_height{100};
166 const int64_t low_activity_weight{1000};
167 AddRemovedBlock(custom_mempool_estimator, low_activity_weight / 2, low_activity_weight, custom_height);
174 size_t block_count = 1;
176 unsigned int height = 100;
181 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
201 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
203 while (block_count <= 3) {
205 if (block_count < 3) {
206 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
224 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
233 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
237 BOOST_CHECK(!mempool_estimator.IsMempoolHealthy());
242 LOCK(m_node.mempool->cs);
248 const FeePerVSize floor{std::max(m_node.mempool->m_opts.min_relay_feerate, m_node.mempool->GetMinFee()).GetFeePerVSize()};
250 const auto result = mempool_estimator.EstimateFeeRate(
true);
251 BOOST_REQUIRE(result.has_value());
257 const auto cached_result = mempool_estimator.EstimateFeeRate(
true);
258 BOOST_REQUIRE(cached_result.has_value());
279 const auto result = mempool_estimator.EstimateFeeRate(
true);
280 BOOST_REQUIRE(result.has_value());
294 const auto conservative = mempool_estimator.EstimateFeeRate(
true);
295 const auto economical = mempool_estimator.EstimateFeeRate(
false);
296 BOOST_REQUIRE(conservative.has_value());
297 BOOST_REQUIRE(economical.has_value());
313 const auto result_conservative = mempool_estimator.EstimateFeeRate(
true);
314 const auto result_economical = mempool_estimator.EstimateFeeRate(
false);
FastRandomContext(bool fDeterministic=false) noexcept
Construct a FastRandomContext with GetRandHash()-based entropy (or zero key if fDeterministic).
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const