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 <node/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 
18 
19 namespace {
20 
21 const TestingSetup* g_setup;
22 std::vector<COutPoint> g_outpoints_coinbase_init_mature;
23 std::vector<COutPoint> g_outpoints_coinbase_init_immature;
24 
25 struct MockedTxPool : public CTxMemPool {
26  void RollingFeeUpdate() EXCLUSIVE_LOCKS_REQUIRED(!cs)
27  {
28  LOCK(cs);
29  lastRollingFeeUpdate = GetTime();
30  blockSinceLastRollingFeeBump = true;
31  }
32 };
33 
34 class DummyChainState final : public CChainState
35 {
36 public:
37  void SetMempool(CTxMemPool* mempool)
38  {
39  m_mempool = mempool;
40  }
41 };
42 
43 void initialize_tx_pool()
44 {
45  static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
46  g_setup = testing_setup.get();
47 
48  for (int i = 0; i < 2 * COINBASE_MATURITY; ++i) {
49  CTxIn in = MineBlock(g_setup->m_node, P2WSH_OP_TRUE);
50  // Remember the txids to avoid expensive disk access later on
51  auto& outpoints = i < COINBASE_MATURITY ?
52  g_outpoints_coinbase_init_mature :
53  g_outpoints_coinbase_init_immature;
54  outpoints.push_back(in.prevout);
55  }
57 }
58 
59 struct TransactionsDelta final : public CValidationInterface {
60  std::set<CTransactionRef>& m_removed;
61  std::set<CTransactionRef>& m_added;
62 
63  explicit TransactionsDelta(std::set<CTransactionRef>& r, std::set<CTransactionRef>& a)
64  : m_removed{r}, m_added{a} {}
65 
66  void TransactionAddedToMempool(const CTransactionRef& tx, uint64_t /* mempool_sequence */) override
67  {
68  Assert(m_added.insert(tx).second);
69  }
70 
71  void TransactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t /* mempool_sequence */) override
72  {
73  Assert(m_removed.insert(tx).second);
74  }
75 };
76 
77 void SetMempoolConstraints(ArgsManager& args, FuzzedDataProvider& fuzzed_data_provider)
78 {
79  args.ForceSetArg("-limitancestorcount",
80  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 50)));
81  args.ForceSetArg("-limitancestorsize",
82  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 202)));
83  args.ForceSetArg("-limitdescendantcount",
84  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 50)));
85  args.ForceSetArg("-limitdescendantsize",
86  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 202)));
87  args.ForceSetArg("-maxmempool",
88  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 200)));
89  args.ForceSetArg("-mempoolexpiry",
90  ToString(fuzzed_data_provider.ConsumeIntegralInRange<unsigned>(0, 999)));
91 }
92 
93 void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, CChainState& chainstate)
94 {
95  WITH_LOCK(::cs_main, tx_pool.check(chainstate.CoinsTip(), chainstate.m_chain.Height() + 1));
96  {
97  BlockAssembler::Options options;
98  options.nBlockMaxWeight = fuzzed_data_provider.ConsumeIntegralInRange(0U, MAX_BLOCK_WEIGHT);
99  options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /*max=*/COIN)};
100  auto assembler = BlockAssembler{chainstate, *static_cast<CTxMemPool*>(&tx_pool), chainstate.m_params, options};
101  auto block_template = assembler.CreateNewBlock(CScript{} << OP_TRUE);
102  Assert(block_template->block.vtx.size() >= 1);
103  }
104  const auto info_all = tx_pool.infoAll();
105  if (!info_all.empty()) {
106  const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
107  WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */));
108  std::vector<uint256> all_txids;
109  tx_pool.queryHashes(all_txids);
110  assert(all_txids.size() < info_all.size());
111  WITH_LOCK(::cs_main, tx_pool.check(chainstate.CoinsTip(), chainstate.m_chain.Height() + 1));
112  }
114 }
115 
116 void MockTime(FuzzedDataProvider& fuzzed_data_provider, const CChainState& chainstate)
117 {
118  const auto time = ConsumeTime(fuzzed_data_provider,
119  chainstate.m_chain.Tip()->GetMedianTimePast() + 1,
120  std::numeric_limits<decltype(chainstate.m_chain.Tip()->nTime)>::max());
121  SetMockTime(time);
122 }
123 
124 FUZZ_TARGET_INIT(tx_pool_standard, initialize_tx_pool)
125 {
126  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
127  const auto& node = g_setup->m_node;
128  auto& chainstate{static_cast<DummyChainState&>(node.chainman->ActiveChainstate())};
129 
130  MockTime(fuzzed_data_provider, chainstate);
131  SetMempoolConstraints(*node.args, fuzzed_data_provider);
132 
133  // All RBF-spendable outpoints
134  std::set<COutPoint> outpoints_rbf;
135  // All outpoints counting toward the total supply (subset of outpoints_rbf)
136  std::set<COutPoint> outpoints_supply;
137  for (const auto& outpoint : g_outpoints_coinbase_init_mature) {
138  Assert(outpoints_supply.insert(outpoint).second);
139  }
140  outpoints_rbf = outpoints_supply;
141 
142  // The sum of the values of all spendable outpoints
143  constexpr CAmount SUPPLY_TOTAL{COINBASE_MATURITY * 50 * COIN};
144 
145  CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
146  MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
147 
148  chainstate.SetMempool(&tx_pool);
149 
150  // Helper to query an amount
151  const CCoinsViewMemPool amount_view{WITH_LOCK(::cs_main, return &chainstate.CoinsTip()), tx_pool};
152  const auto GetAmount = [&](const COutPoint& outpoint) {
153  Coin c;
154  Assert(amount_view.GetCoin(outpoint, c));
155  return c.out.nValue;
156  };
157 
158  LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
159  {
160  {
161  // Total supply is the mempool fee + all outpoints
162  CAmount supply_now{WITH_LOCK(tx_pool.cs, return tx_pool.GetTotalFee())};
163  for (const auto& op : outpoints_supply) {
164  supply_now += GetAmount(op);
165  }
166  Assert(supply_now == SUPPLY_TOTAL);
167  }
168  Assert(!outpoints_supply.empty());
169 
170  // Create transaction to add to the mempool
171  const CTransactionRef tx = [&] {
172  CMutableTransaction tx_mut;
174  tx_mut.nLockTime = fuzzed_data_provider.ConsumeBool() ? 0 : fuzzed_data_provider.ConsumeIntegral<uint32_t>();
175  const auto num_in = fuzzed_data_provider.ConsumeIntegralInRange<int>(1, outpoints_rbf.size());
176  const auto num_out = fuzzed_data_provider.ConsumeIntegralInRange<int>(1, outpoints_rbf.size() * 2);
177 
178  CAmount amount_in{0};
179  for (int i = 0; i < num_in; ++i) {
180  // Pop random outpoint
181  auto pop = outpoints_rbf.begin();
182  std::advance(pop, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, outpoints_rbf.size() - 1));
183  const auto outpoint = *pop;
184  outpoints_rbf.erase(pop);
185  amount_in += GetAmount(outpoint);
186 
187  // Create input
188  const auto sequence = ConsumeSequence(fuzzed_data_provider);
189  const auto script_sig = CScript{};
190  const auto script_wit_stack = std::vector<std::vector<uint8_t>>{WITNESS_STACK_ELEM_OP_TRUE};
191  CTxIn in;
192  in.prevout = outpoint;
193  in.nSequence = sequence;
194  in.scriptSig = script_sig;
195  in.scriptWitness.stack = script_wit_stack;
196 
197  tx_mut.vin.push_back(in);
198  }
199  const auto amount_fee = fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(-1000, amount_in);
200  const auto amount_out = (amount_in - amount_fee) / num_out;
201  for (int i = 0; i < num_out; ++i) {
202  tx_mut.vout.emplace_back(amount_out, P2WSH_OP_TRUE);
203  }
204  const auto tx = MakeTransactionRef(tx_mut);
205  // Restore previously removed outpoints
206  for (const auto& in : tx->vin) {
207  Assert(outpoints_rbf.insert(in.prevout).second);
208  }
209  return tx;
210  }();
211 
212  if (fuzzed_data_provider.ConsumeBool()) {
213  MockTime(fuzzed_data_provider, chainstate);
214  }
215  if (fuzzed_data_provider.ConsumeBool()) {
216  SetMempoolConstraints(*node.args, fuzzed_data_provider);
217  }
218  if (fuzzed_data_provider.ConsumeBool()) {
219  tx_pool.RollingFeeUpdate();
220  }
221  if (fuzzed_data_provider.ConsumeBool()) {
222  const auto& txid = fuzzed_data_provider.ConsumeBool() ?
223  tx->GetHash() :
224  PickValue(fuzzed_data_provider, outpoints_rbf).hash;
225  const auto delta = fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(-50 * COIN, +50 * COIN);
226  tx_pool.PrioritiseTransaction(txid, delta);
227  }
228 
229  // Remember all removed and added transactions
230  std::set<CTransactionRef> removed;
231  std::set<CTransactionRef> added;
232  auto txr = std::make_shared<TransactionsDelta>(removed, added);
234  const bool bypass_limits = fuzzed_data_provider.ConsumeBool();
235  ::fRequireStandard = fuzzed_data_provider.ConsumeBool();
236 
237  // Make sure ProcessNewPackage on one transaction works and always fully validates the transaction.
238  // The result is not guaranteed to be the same as what is returned by ATMP.
239  const auto result_package = WITH_LOCK(::cs_main,
240  return ProcessNewPackage(chainstate, tx_pool, {tx}, true));
241  auto it = result_package.m_tx_results.find(tx->GetWitnessHash());
242  Assert(it != result_package.m_tx_results.end());
243  Assert(it->second.m_result_type == MempoolAcceptResult::ResultType::VALID ||
244  it->second.m_result_type == MempoolAcceptResult::ResultType::INVALID);
245 
246  const auto res = WITH_LOCK(::cs_main, return AcceptToMemoryPool(chainstate, tx, GetTime(), bypass_limits, /*test_accept=*/false));
247  const bool accepted = res.m_result_type == MempoolAcceptResult::ResultType::VALID;
250 
251  Assert(accepted != added.empty());
252  Assert(accepted == res.m_state.IsValid());
253  Assert(accepted != res.m_state.IsInvalid());
254  if (accepted) {
255  Assert(added.size() == 1); // For now, no package acceptance
256  Assert(tx == *added.begin());
257  } else {
258  // Do not consider rejected transaction removed
259  removed.erase(tx);
260  }
261 
262  // Helper to insert spent and created outpoints of a tx into collections
263  using Sets = std::vector<std::reference_wrapper<std::set<COutPoint>>>;
264  const auto insert_tx = [](Sets created_by_tx, Sets consumed_by_tx, const auto& tx) {
265  for (size_t i{0}; i < tx.vout.size(); ++i) {
266  for (auto& set : created_by_tx) {
267  Assert(set.get().emplace(tx.GetHash(), i).second);
268  }
269  }
270  for (const auto& in : tx.vin) {
271  for (auto& set : consumed_by_tx) {
272  Assert(set.get().insert(in.prevout).second);
273  }
274  }
275  };
276  // Add created outpoints, remove spent outpoints
277  {
278  // Outpoints that no longer exist at all
279  std::set<COutPoint> consumed_erased;
280  // Outpoints that no longer count toward the total supply
281  std::set<COutPoint> consumed_supply;
282  for (const auto& removed_tx : removed) {
283  insert_tx(/*created_by_tx=*/{consumed_erased}, /*consumed_by_tx=*/{outpoints_supply}, /*tx=*/*removed_tx);
284  }
285  for (const auto& added_tx : added) {
286  insert_tx(/*created_by_tx=*/{outpoints_supply, outpoints_rbf}, /*consumed_by_tx=*/{consumed_supply}, /*tx=*/*added_tx);
287  }
288  for (const auto& p : consumed_erased) {
289  Assert(outpoints_supply.erase(p) == 1);
290  Assert(outpoints_rbf.erase(p) == 1);
291  }
292  for (const auto& p : consumed_supply) {
293  Assert(outpoints_supply.erase(p) == 1);
294  }
295  }
296  }
297  Finish(fuzzed_data_provider, tx_pool, chainstate);
298 }
299 
300 FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
301 {
302  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
303  const auto& node = g_setup->m_node;
304  auto& chainstate = node.chainman->ActiveChainstate();
305 
306  MockTime(fuzzed_data_provider, chainstate);
307  SetMempoolConstraints(*node.args, fuzzed_data_provider);
308 
309  std::vector<uint256> txids;
310  for (const auto& outpoint : g_outpoints_coinbase_init_mature) {
311  txids.push_back(outpoint.hash);
312  }
313  for (int i{0}; i <= 3; ++i) {
314  // Add some immature and non-existent outpoints
315  txids.push_back(g_outpoints_coinbase_init_immature.at(i).hash);
316  txids.push_back(ConsumeUInt256(fuzzed_data_provider));
317  }
318 
319  CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
320  MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
321 
322  LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
323  {
324  const auto mut_tx = ConsumeTransaction(fuzzed_data_provider, txids);
325 
326  if (fuzzed_data_provider.ConsumeBool()) {
327  MockTime(fuzzed_data_provider, chainstate);
328  }
329  if (fuzzed_data_provider.ConsumeBool()) {
330  SetMempoolConstraints(*node.args, fuzzed_data_provider);
331  }
332  if (fuzzed_data_provider.ConsumeBool()) {
333  tx_pool.RollingFeeUpdate();
334  }
335  if (fuzzed_data_provider.ConsumeBool()) {
336  const auto& txid = fuzzed_data_provider.ConsumeBool() ?
337  mut_tx.GetHash() :
338  PickValue(fuzzed_data_provider, txids);
339  const auto delta = fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(-50 * COIN, +50 * COIN);
340  tx_pool.PrioritiseTransaction(txid, delta);
341  }
342 
343  const auto tx = MakeTransactionRef(mut_tx);
344  const bool bypass_limits = fuzzed_data_provider.ConsumeBool();
345  ::fRequireStandard = fuzzed_data_provider.ConsumeBool();
346  const auto res = WITH_LOCK(::cs_main, return AcceptToMemoryPool(chainstate, tx, GetTime(), bypass_limits, /*test_accept=*/false));
347  const bool accepted = res.m_result_type == MempoolAcceptResult::ResultType::VALID;
348  if (accepted) {
349  txids.push_back(tx->GetHash());
350  }
351  }
352  Finish(fuzzed_data_provider, tx_pool, chainstate);
353 }
354 } // 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
ConsumeUInt256
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition: util.h:155
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
BasicTestingSetup::m_node
node::NodeContext m_node
Definition: setup_common.h:85
assert
assert(!tx.IsCoinBase())
CBlockIndex::nTime
uint32_t nTime
Definition: chain.h:203
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
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:429
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
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:434
MineBlock
CTxIn MineBlock(const NodeContext &node, const CScript &coinbase_scriptPubKey)
Returns the generated coin.
Definition: mining.cpp:62
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:281
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:285
SetMockTime
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
Definition: time.cpp:101
fRequireStandard
bool fRequireStandard
Definition: validation.cpp:145
CChainState::m_params
const CChainParams & m_params
Chain parameters for this chainstate.
Definition: validation.h:484
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:624
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:289
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:443
LIMITED_WHILE
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
Definition: fuzz.h:18
node::BlockAssembler
Generate a new block, without valid proof-of-work.
Definition: miner.h:128
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
OP_TRUE
@ OP_TRUE
Definition: script.h:77
CChain::Height
int Height() const
Return the maximal height in the chain.
Definition: chain.h:463
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
cs_main
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: validation.cpp:138
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:347
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:864
TestingSetup
Testing setup that configures a complete environment.
Definition: setup_common.h:107
node
Definition: init.h:22
ConsumeSequence
uint32_t ConsumeSequence(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition: util.cpp:406
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
COIN
static constexpr CAmount COIN
The amount of satoshis in one BTC.
Definition: amount.h:15
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:344
FUZZ_TARGET_INIT
#define FUZZ_TARGET_INIT(name, init_fun)
Definition: fuzz.h:34
AcceptToMemoryPool
MempoolAcceptResult AcceptToMemoryPool(CChainState &active_chainstate, const CTransactionRef &tx, int64_t accept_time, bool bypass_limits, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Try to add a transaction to the mempool.
Definition: validation.cpp:1322
ConsumeMoney
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
Definition: util.cpp:276
CChainState::CoinsTip
CCoinsViewCache & CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Definition: validation.h:543
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:521
mining.h
PickValue
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
Definition: util.h:54
args
ArgsManager args
Definition: notifications.cpp:36
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)
Validate (and maybe submit) a package to the mempool.
Definition: validation.cpp:1348