Bitcoin Core  22.99.0
P2P Digital Currency
tx_pool.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <consensus/validation.h>
6 #include <miner.h>
8 #include <test/fuzz/fuzz.h>
9 #include <test/fuzz/util.h>
10 #include <test/util/mining.h>
11 #include <test/util/script.h>
12 #include <test/util/setup_common.h>
13 #include <util/rbf.h>
14 #include <validation.h>
15 #include <validationinterface.h>
16 
17 namespace {
18 
19 const TestingSetup* g_setup;
20 std::vector<COutPoint> g_outpoints_coinbase_init_mature;
21 std::vector<COutPoint> g_outpoints_coinbase_init_immature;
22 
23 struct MockedTxPool : public CTxMemPool {
24  void RollingFeeUpdate() EXCLUSIVE_LOCKS_REQUIRED(!cs)
25  {
26  LOCK(cs);
27  lastRollingFeeUpdate = GetTime();
28  blockSinceLastRollingFeeBump = true;
29  }
30 };
31 
32 void initialize_tx_pool()
33 {
34  static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
35  g_setup = testing_setup.get();
36 
37  for (int i = 0; i < 2 * COINBASE_MATURITY; ++i) {
38  CTxIn in = MineBlock(g_setup->m_node, P2WSH_OP_TRUE);
39  // Remember the txids to avoid expensive disk access later on
40  auto& outpoints = i < COINBASE_MATURITY ?
41  g_outpoints_coinbase_init_mature :
42  g_outpoints_coinbase_init_immature;
43  outpoints.push_back(in.prevout);
44  }
46 }
47 
48 struct TransactionsDelta final : public CValidationInterface {
49  std::set<CTransactionRef>& m_removed;
50  std::set<CTransactionRef>& m_added;
51 
52  explicit TransactionsDelta(std::set<CTransactionRef>& r, std::set<CTransactionRef>& a)
53  : m_removed{r}, m_added{a} {}
54 
55  void TransactionAddedToMempool(const CTransactionRef& tx, uint64_t /* mempool_sequence */) override
56  {
57  Assert(m_added.insert(tx).second);
58  }
59 
60  void TransactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t /* mempool_sequence */) override
61  {
62  Assert(m_removed.insert(tx).second);
63  }
64 };
65 
66 void SetMempoolConstraints(ArgsManager& args, FuzzedDataProvider& fuzzed_data_provider)
67 {
68  args.ForceSetArg("-limitancestorcount",
69  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 50)));
70  args.ForceSetArg("-limitancestorsize",
71  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 202)));
72  args.ForceSetArg("-limitdescendantcount",
73  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 50)));
74  args.ForceSetArg("-limitdescendantsize",
75  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 202)));
76  args.ForceSetArg("-maxmempool",
77  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 200)));
78  args.ForceSetArg("-mempoolexpiry",
79  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 999)));
80 }
81 
82 void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, CChainState& chainstate)
83 {
84  WITH_LOCK(::cs_main, tx_pool.check(chainstate));
85  {
87  options.nBlockMaxWeight = fuzzed_data_provider.ConsumeIntegralInRange(0U, MAX_BLOCK_WEIGHT);
88  options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /* max */ COIN)};
89  auto assembler = BlockAssembler{chainstate, *static_cast<CTxMemPool*>(&tx_pool), ::Params(), options};
90  auto block_template = assembler.CreateNewBlock(CScript{} << OP_TRUE);
91  Assert(block_template->block.vtx.size() >= 1);
92  }
93  const auto info_all = tx_pool.infoAll();
94  if (!info_all.empty()) {
95  const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
96  WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, /* dummy */ MemPoolRemovalReason::BLOCK));
97  std::vector<uint256> all_txids;
98  tx_pool.queryHashes(all_txids);
99  assert(all_txids.size() < info_all.size());
100  WITH_LOCK(::cs_main, tx_pool.check(chainstate));
101  }
103 }
104 
105 void MockTime(FuzzedDataProvider& fuzzed_data_provider, const CChainState& chainstate)
106 {
107  const auto time = ConsumeTime(fuzzed_data_provider,
108  chainstate.m_chain.Tip()->GetMedianTimePast() + 1,
109  std::numeric_limits<decltype(chainstate.m_chain.Tip()->nTime)>::max());
110  SetMockTime(time);
111 }
112 
113 FUZZ_TARGET_INIT(tx_pool_standard, initialize_tx_pool)
114 {
115  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
116  const auto& node = g_setup->m_node;
117  auto& chainstate = node.chainman->ActiveChainstate();
118 
119  MockTime(fuzzed_data_provider, chainstate);
120  SetMempoolConstraints(*node.args, fuzzed_data_provider);
121 
122  // All RBF-spendable outpoints
123  std::set<COutPoint> outpoints_rbf;
124  // All outpoints counting toward the total supply (subset of outpoints_rbf)
125  std::set<COutPoint> outpoints_supply;
126  for (const auto& outpoint : g_outpoints_coinbase_init_mature) {
127  Assert(outpoints_supply.insert(outpoint).second);
128  }
129  outpoints_rbf = outpoints_supply;
130 
131  // The sum of the values of all spendable outpoints
132  constexpr CAmount SUPPLY_TOTAL{COINBASE_MATURITY * 50 * COIN};
133 
134  CTxMemPool tx_pool_{/* estimator */ nullptr, /* check_ratio */ 1};
135  MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
136 
137  // Helper to query an amount
138  const CCoinsViewMemPool amount_view{WITH_LOCK(::cs_main, return &chainstate.CoinsTip()), tx_pool};
139  const auto GetAmount = [&](const COutPoint& outpoint) {
140  Coin c;
141  Assert(amount_view.GetCoin(outpoint, c));
142  return c.out.nValue;
143  };
144 
145  LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
146  {
147  {
148  // Total supply is the mempool fee + all outpoints
149  CAmount supply_now{WITH_LOCK(tx_pool.cs, return tx_pool.GetTotalFee())};
150  for (const auto& op : outpoints_supply) {
151  supply_now += GetAmount(op);
152  }
153  Assert(supply_now == SUPPLY_TOTAL);
154  }
155  Assert(!outpoints_supply.empty());
156 
157  // Create transaction to add to the mempool
158  const CTransactionRef tx = [&] {
159  CMutableTransaction tx_mut;
161  tx_mut.nLockTime = fuzzed_data_provider.ConsumeBool() ? 0 : fuzzed_data_provider.ConsumeIntegral<uint32_t>();
162  const auto num_in = fuzzed_data_provider.ConsumeIntegralInRange<int>(1, outpoints_rbf.size());
163  const auto num_out = fuzzed_data_provider.ConsumeIntegralInRange<int>(1, outpoints_rbf.size() * 2);
164 
165  CAmount amount_in{0};
166  for (int i = 0; i < num_in; ++i) {
167  // Pop random outpoint
168  auto pop = outpoints_rbf.begin();
169  std::advance(pop, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, outpoints_rbf.size() - 1));
170  const auto outpoint = *pop;
171  outpoints_rbf.erase(pop);
172  amount_in += GetAmount(outpoint);
173 
174  // Create input
175  const auto sequence = ConsumeSequence(fuzzed_data_provider);
176  const auto script_sig = CScript{};
177  const auto script_wit_stack = std::vector<std::vector<uint8_t>>{WITNESS_STACK_ELEM_OP_TRUE};
178  CTxIn in;
179  in.prevout = outpoint;
180  in.nSequence = sequence;
181  in.scriptSig = script_sig;
182  in.scriptWitness.stack = script_wit_stack;
183 
184  tx_mut.vin.push_back(in);
185  }
186  const auto amount_fee = fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(-1000, amount_in);
187  const auto amount_out = (amount_in - amount_fee) / num_out;
188  for (int i = 0; i < num_out; ++i) {
189  tx_mut.vout.emplace_back(amount_out, P2WSH_OP_TRUE);
190  }
191  const auto tx = MakeTransactionRef(tx_mut);
192  // Restore previously removed outpoints
193  for (const auto& in : tx->vin) {
194  Assert(outpoints_rbf.insert(in.prevout).second);
195  }
196  return tx;
197  }();
198 
199  if (fuzzed_data_provider.ConsumeBool()) {
200  MockTime(fuzzed_data_provider, chainstate);
201  }
202  if (fuzzed_data_provider.ConsumeBool()) {
203  SetMempoolConstraints(*node.args, fuzzed_data_provider);
204  }
205  if (fuzzed_data_provider.ConsumeBool()) {
206  tx_pool.RollingFeeUpdate();
207  }
208  if (fuzzed_data_provider.ConsumeBool()) {
209  const auto& txid = fuzzed_data_provider.ConsumeBool() ?
210  tx->GetHash() :
211  PickValue(fuzzed_data_provider, outpoints_rbf).hash;
212  const auto delta = fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(-50 * COIN, +50 * COIN);
213  tx_pool.PrioritiseTransaction(txid, delta);
214  }
215 
216  // Remember all removed and added transactions
217  std::set<CTransactionRef> removed;
218  std::set<CTransactionRef> added;
219  auto txr = std::make_shared<TransactionsDelta>(removed, added);
221  const bool bypass_limits = fuzzed_data_provider.ConsumeBool();
222  ::fRequireStandard = fuzzed_data_provider.ConsumeBool();
223 
224  // Make sure ProcessNewPackage on one transaction works and always fully validates the transaction.
225  // The result is not guaranteed to be the same as what is returned by ATMP.
226  const auto result_package = WITH_LOCK(::cs_main,
227  return ProcessNewPackage(node.chainman->ActiveChainstate(), tx_pool, {tx}, true));
228  auto it = result_package.m_tx_results.find(tx->GetWitnessHash());
229  Assert(it != result_package.m_tx_results.end());
230  Assert(it->second.m_result_type == MempoolAcceptResult::ResultType::VALID ||
231  it->second.m_result_type == MempoolAcceptResult::ResultType::INVALID);
232 
233  const auto res = WITH_LOCK(::cs_main, return AcceptToMemoryPool(chainstate, tx_pool, tx, bypass_limits));
234  const bool accepted = res.m_result_type == MempoolAcceptResult::ResultType::VALID;
237 
238  Assert(accepted != added.empty());
239  Assert(accepted == res.m_state.IsValid());
240  Assert(accepted != res.m_state.IsInvalid());
241  if (accepted) {
242  Assert(added.size() == 1); // For now, no package acceptance
243  Assert(tx == *added.begin());
244  } else {
245  // Do not consider rejected transaction removed
246  removed.erase(tx);
247  }
248 
249  // Helper to insert spent and created outpoints of a tx into collections
250  using Sets = std::vector<std::reference_wrapper<std::set<COutPoint>>>;
251  const auto insert_tx = [](Sets created_by_tx, Sets consumed_by_tx, const auto& tx) {
252  for (size_t i{0}; i < tx.vout.size(); ++i) {
253  for (auto& set : created_by_tx) {
254  Assert(set.get().emplace(tx.GetHash(), i).second);
255  }
256  }
257  for (const auto& in : tx.vin) {
258  for (auto& set : consumed_by_tx) {
259  Assert(set.get().insert(in.prevout).second);
260  }
261  }
262  };
263  // Add created outpoints, remove spent outpoints
264  {
265  // Outpoints that no longer exist at all
266  std::set<COutPoint> consumed_erased;
267  // Outpoints that no longer count toward the total supply
268  std::set<COutPoint> consumed_supply;
269  for (const auto& removed_tx : removed) {
270  insert_tx(/* created_by_tx */ {consumed_erased}, /* consumed_by_tx */ {outpoints_supply}, /* tx */ *removed_tx);
271  }
272  for (const auto& added_tx : added) {
273  insert_tx(/* created_by_tx */ {outpoints_supply, outpoints_rbf}, /* consumed_by_tx */ {consumed_supply}, /* tx */ *added_tx);
274  }
275  for (const auto& p : consumed_erased) {
276  Assert(outpoints_supply.erase(p) == 1);
277  Assert(outpoints_rbf.erase(p) == 1);
278  }
279  for (const auto& p : consumed_supply) {
280  Assert(outpoints_supply.erase(p) == 1);
281  }
282  }
283  }
284  Finish(fuzzed_data_provider, tx_pool, chainstate);
285 }
286 
287 FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
288 {
289  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
290  const auto& node = g_setup->m_node;
291  auto& chainstate = node.chainman->ActiveChainstate();
292 
293  MockTime(fuzzed_data_provider, chainstate);
294  SetMempoolConstraints(*node.args, fuzzed_data_provider);
295 
296  std::vector<uint256> txids;
297  for (const auto& outpoint : g_outpoints_coinbase_init_mature) {
298  txids.push_back(outpoint.hash);
299  }
300  for (int i{0}; i <= 3; ++i) {
301  // Add some immature and non-existent outpoints
302  txids.push_back(g_outpoints_coinbase_init_immature.at(i).hash);
303  txids.push_back(ConsumeUInt256(fuzzed_data_provider));
304  }
305 
306  CTxMemPool tx_pool_{/* estimator */ nullptr, /* check_ratio */ 1};
307  MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
308 
309  LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
310  {
311  const auto mut_tx = ConsumeTransaction(fuzzed_data_provider, txids);
312 
313  if (fuzzed_data_provider.ConsumeBool()) {
314  MockTime(fuzzed_data_provider, chainstate);
315  }
316  if (fuzzed_data_provider.ConsumeBool()) {
317  SetMempoolConstraints(*node.args, fuzzed_data_provider);
318  }
319  if (fuzzed_data_provider.ConsumeBool()) {
320  tx_pool.RollingFeeUpdate();
321  }
322  if (fuzzed_data_provider.ConsumeBool()) {
323  const auto& txid = fuzzed_data_provider.ConsumeBool() ?
324  mut_tx.GetHash() :
325  PickValue(fuzzed_data_provider, txids);
326  const auto delta = fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(-50 * COIN, +50 * COIN);
327  tx_pool.PrioritiseTransaction(txid, delta);
328  }
329 
330  const auto tx = MakeTransactionRef(mut_tx);
331  const bool bypass_limits = fuzzed_data_provider.ConsumeBool();
332  ::fRequireStandard = fuzzed_data_provider.ConsumeBool();
333  const auto res = WITH_LOCK(::cs_main, return AcceptToMemoryPool(node.chainman->ActiveChainstate(), tx_pool, tx, bypass_limits));
334  const bool accepted = res.m_result_type == MempoolAcceptResult::ResultType::VALID;
335  if (accepted) {
336  txids.push_back(tx->GetHash());
337  }
338  }
339  Finish(fuzzed_data_provider, tx_pool, chainstate);
340 }
341 } // namespace
CValidationInterface
Implement this to subscribe to events generated in validation.
Definition: validationinterface.h:78
CTxIn
An input of a transaction.
Definition: transaction.h:65
BlockAssembler::Options::blockMinFeeRate
CFeeRate blockMinFeeRate
Definition: miner.h:155
ConsumeUInt256
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition: util.h:153
CMutableTransaction::vin
std::vector< CTxIn > vin
Definition: transaction.h:346
ToString
std::string ToString(const T &t)
Locale-independent version of std::to_string.
Definition: string.h:87
RegisterSharedValidationInterface
void RegisterSharedValidationInterface(std::shared_ptr< CValidationInterface > callbacks)
Register subscriber.
Definition: validationinterface.cpp:121
assert
assert(!tx.IsCoinBase())
CBlockIndex::nTime
uint32_t nTime
Definition: chain.h:192
COINBASE_MATURITY
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
Definition: consensus.h:19
setup_common.h
AcceptToMemoryPool
MempoolAcceptResult AcceptToMemoryPool(CChainState &active_chainstate, CTxMemPool &pool, const CTransactionRef &tx, bool bypass_limits, bool test_accept)
(Try to) add a transaction to the memory pool.
Definition: validation.cpp:1040
CMutableTransaction::nVersion
int32_t nVersion
Definition: transaction.h:348
CTxMemPool
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:478
validationinterface.h
validation.h
util.h
GetTime
int64_t GetTime()
DEPRECATED Use either GetTimeSeconds (not mockable) or GetTime<T> (mockable)
Definition: time.cpp:26
WITH_LOCK
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
Definition: sync.h:270
MakeTransactionRef
static CTransactionRef MakeTransactionRef(Tx &&txIn)
Definition: transaction.h:387
BlockAssembler
Generate a new block, without valid proof-of-work.
Definition: miner.h:126
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:386
CChain::Tip
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
Definition: chain.h:403
MineBlock
CTxIn MineBlock(const NodeContext &node, const CScript &coinbase_scriptPubKey)
Returns the generated coin.
Definition: mining.cpp:59
Assert
#define Assert(val)
Identity function.
Definition: check.h:57
CFeeRate
Fee rate in satoshis per kilobyte: CAmount / kB.
Definition: feerate.h:29
rbf.h
cs
static void pool cs
Definition: mempool_eviction.cpp:12
CTxIn::nSequence
uint32_t nSequence
Definition: transaction.h:70
CTxIn::scriptWitness
CScriptWitness scriptWitness
Only serialized through CTransaction.
Definition: transaction.h:71
Coin::out
CTxOut out
unspent transaction output
Definition: coins.h:34
CTxOut::nValue
CAmount nValue
Definition: transaction.h:131
ConsumeTime
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
Definition: util.cpp:226
WITNESS_STACK_ELEM_OP_TRUE
static const std::vector< uint8_t > WITNESS_STACK_ELEM_OP_TRUE
Definition: script.h:11
SyncWithValidationInterfaceQueue
void SyncWithValidationInterfaceQueue()
This is a synonym for the following, which asserts certain locks are not held: std::promise<void> pro...
Definition: validationinterface.cpp:160
script.h
CMutableTransaction::nLockTime
uint32_t nLockTime
Definition: transaction.h:349
Coin
A UTXO entry.
Definition: coins.h:30
CBlockIndex::GetMedianTimePast
int64_t GetMedianTimePast() const
Definition: chain.h:272
SetMockTime
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
Definition: time.cpp:101
fRequireStandard
bool fRequireStandard
Definition: validation.cpp:123
MempoolAcceptResult::ResultType::INVALID
@ INVALID
Fully validated, valid.
miner.h
FuzzedDataProvider.h
ArgsManager::ForceSetArg
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:622
UnregisterSharedValidationInterface
void UnregisterSharedValidationInterface(std::shared_ptr< CValidationInterface > callbacks)
Unregister subscriber.
Definition: validationinterface.cpp:135
ConsumeTransaction
CMutableTransaction ConsumeTransaction(FuzzedDataProvider &fuzzed_data_provider, const std::optional< std::vector< uint256 >> &prevout_txids, const int max_num_in, const int max_num_out) noexcept
Definition: util.cpp:234
BlockAssembler::Options::nBlockMaxWeight
size_t nBlockMaxWeight
Definition: miner.h:154
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
CChainState
CChainState stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:556
LIMITED_WHILE
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
Definition: fuzz.h:18
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
OP_TRUE
@ OP_TRUE
Definition: script.h:77
MempoolAcceptResult::ResultType::VALID
@ VALID
CTransaction::CURRENT_VERSION
static const int32_t CURRENT_VERSION
Definition: transaction.h:263
CMutableTransaction::vout
std::vector< CTxOut > vout
Definition: transaction.h:347
BlockAssembler::Options
Definition: miner.h:152
BasicTestingSetup::m_node
NodeContext m_node
Definition: setup_common.h:78
cs_main
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: validation.cpp:116
ArgsManager
Definition: system.h:158
fuzz.h
EXCLUSIVE_LOCKS_REQUIRED
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:49
LOCK
#define LOCK(cs)
Definition: sync.h:226
FuzzedDataProvider
Definition: FuzzedDataProvider.h:31
MemPoolRemovalReason
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Definition: txmempool.h:396
FuzzedDataProvider::ConsumeIntegral
T ConsumeIntegral()
Definition: FuzzedDataProvider.h:194
MAX_BLOCK_WEIGHT
static const unsigned int MAX_BLOCK_WEIGHT
The maximum allowed weight for a block, see BIP 141 (network rule)
Definition: consensus.h:15
CTxIn::prevout
COutPoint prevout
Definition: transaction.h:68
CTxIn::scriptSig
CScript scriptSig
Definition: transaction.h:69
CCoinsViewMemPool
CCoinsView that brings transactions from a mempool into view.
Definition: txmempool.h:906
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:536
TestingSetup
Testing setup that configures a complete environment.
Definition: setup_common.h:99
node
Definition: interfaces.cpp:68
COIN
static const CAmount COIN
Definition: amount.h:14
ConsumeSequence
uint32_t ConsumeSequence(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition: util.cpp:298
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
MemPoolRemovalReason::BLOCK
@ BLOCK
Removed for block.
FuzzedDataProvider::ConsumeBool
bool ConsumeBool()
Definition: FuzzedDataProvider.h:288
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:344
FUZZ_TARGET_INIT
#define FUZZ_TARGET_INIT(name, init_fun)
Definition: fuzz.h:34
ConsumeMoney
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
Definition: util.cpp:221
CChainState::CoinsTip
CCoinsViewCache & CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Definition: validation.h:644
FuzzedDataProvider::ConsumeIntegralInRange
T ConsumeIntegralInRange(T min, T max)
Definition: FuzzedDataProvider.h:204
CScriptWitness::stack
std::vector< std::vector< unsigned char > > stack
Definition: script.h:561
CChainState::m_chain
CChain m_chain
The current chain of blockheaders we consult and build on.
Definition: validation.h:627
mining.h
PickValue
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
Definition: util.h:52
P2WSH_OP_TRUE
static const CScript P2WSH_OP_TRUE
Definition: script.h:12
ProcessNewPackage
PackageMempoolAcceptResult ProcessNewPackage(CChainState &active_chainstate, CTxMemPool &pool, const Package &package, bool test_accept)
Atomically test acceptance of a package.
Definition: validation.cpp:1046