1
- // Copyright (c) 2020-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2020-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
@@ -33,6 +33,12 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
33
33
bool good_data{true };
34
34
35
35
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 ();
36
42
LIMITED_WHILE (good_data && fuzzed_data_provider.ConsumeBool (), 10'000 )
37
43
{
38
44
CallOneOf (
@@ -44,7 +50,7 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
44
50
return ;
45
51
}
46
52
const CTransaction tx{*mtx};
47
- const CTxMemPoolEntry& entry = ConsumeTxMemPoolEntry (fuzzed_data_provider, tx) ;
53
+ const auto entry{ ConsumeTxMemPoolEntry (fuzzed_data_provider, tx, current_height)} ;
48
54
const auto tx_submitted_in_package = fuzzed_data_provider.ConsumeBool ();
49
55
const auto tx_has_mempool_parents = fuzzed_data_provider.ConsumeBool ();
50
56
const auto tx_info = NewMempoolTransactionInfo (entry.GetSharedTx (), entry.GetFee (),
@@ -68,14 +74,15 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
68
74
break ;
69
75
}
70
76
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 ));
72
78
}
73
79
std::vector<RemovedMempoolTransactionInfo> txs;
74
80
txs.reserve (mempool_entries.size ());
75
81
for (const CTxMemPoolEntry& mempool_entry : mempool_entries) {
76
82
txs.emplace_back (mempool_entry);
77
83
}
78
- block_policy_estimator.processBlock (txs, fuzzed_data_provider.ConsumeIntegral <unsigned int >());
84
+ advance_height ();
85
+ block_policy_estimator.processBlock (txs, current_height);
79
86
},
80
87
[&] {
81
88
(void )block_policy_estimator.removeTx (ConsumeUInt256 (fuzzed_data_provider));
0 commit comments