1- // Copyright (c) 2020-2022 The Bitcoin Core developers
1+ // Copyright (c) 2020-present The Bitcoin Core developers
22// Distributed under the MIT software license, see the accompanying
33// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
@@ -33,6 +33,12 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
3333 bool good_data{true };
3434
3535 CBlockPolicyEstimator block_policy_estimator{FeeestPath (*g_setup->m_node .args ), DEFAULT_ACCEPT_STALE_FEE_ESTIMATES};
36+
37+ uint32_t current_height{0 };
38+ const auto advance_height{
39+ [&] { current_height = fuzzed_data_provider.ConsumeIntegralInRange <decltype (current_height)>(current_height, 1 << 30 ); },
40+ };
41+ advance_height ();
3642 LIMITED_WHILE (good_data && fuzzed_data_provider.ConsumeBool (), 10'000 )
3743 {
3844 CallOneOf (
@@ -44,7 +50,7 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
4450 return ;
4551 }
4652 const CTransaction tx{*mtx};
47- const CTxMemPoolEntry& entry = ConsumeTxMemPoolEntry (fuzzed_data_provider, tx) ;
53+ const auto entry{ ConsumeTxMemPoolEntry (fuzzed_data_provider, tx, current_height)} ;
4854 const auto tx_submitted_in_package = fuzzed_data_provider.ConsumeBool ();
4955 const auto tx_has_mempool_parents = fuzzed_data_provider.ConsumeBool ();
5056 const auto tx_info = NewMempoolTransactionInfo (entry.GetSharedTx (), entry.GetFee (),
@@ -68,14 +74,15 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
6874 break ;
6975 }
7076 const CTransaction tx{*mtx};
71- mempool_entries.emplace_back (CTxMemPoolEntry::ExplicitCopy, ConsumeTxMemPoolEntry (fuzzed_data_provider, tx));
77+ mempool_entries.emplace_back (CTxMemPoolEntry::ExplicitCopy, ConsumeTxMemPoolEntry (fuzzed_data_provider, tx, current_height ));
7278 }
7379 std::vector<RemovedMempoolTransactionInfo> txs;
7480 txs.reserve (mempool_entries.size ());
7581 for (const CTxMemPoolEntry& mempool_entry : mempool_entries) {
7682 txs.emplace_back (mempool_entry);
7783 }
78- block_policy_estimator.processBlock (txs, fuzzed_data_provider.ConsumeIntegral <unsigned int >());
84+ advance_height ();
85+ block_policy_estimator.processBlock (txs, current_height);
7986 },
8087 [&] {
8188 (void )block_policy_estimator.removeTx (ConsumeUInt256 (fuzzed_data_provider));
0 commit comments