Bitcoin Core  0.20.99
P2P Digital Currency
Go to the documentation of this file.
1 // Copyright (c) 2016-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or
5 #include <policy/rbf.h>
6 #include <util/rbf.h>
9 {
10  AssertLockHeld(pool.cs);
12  CTxMemPool::setEntries setAncestors;
14  // First check the transaction itself.
15  if (SignalsOptInRBF(tx)) {
17  }
19  // If this transaction is not in our mempool, then we can't be sure
20  // we will know about all its inputs.
21  if (!pool.exists(tx.GetHash())) {
23  }
25  // If all the inputs have nSequence >= maxint-1, it still might be
26  // signaled for RBF if any unconfirmed parents have signaled.
27  uint64_t noLimit = std::numeric_limits<uint64_t>::max();
28  std::string dummy;
29  CTxMemPoolEntry entry = *pool.mapTx.find(tx.GetHash());
30  pool.CalculateMemPoolAncestors(entry, setAncestors, noLimit, noLimit, noLimit, noLimit, dummy, false);
32  for (CTxMemPool::txiter it : setAncestors) {
33  if (SignalsOptInRBF(it->GetTx())) {
35  }
36  }
38 }
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
Definition: txmempool.h:523
RBFTransactionState IsRBFOptIn(const CTransaction &tx, const CTxMemPool &pool)
Definition: rbf.cpp:8
std::set< txiter, CompareIteratorByHash > setEntries
Definition: txmempool.h:531
bool SignalsOptInRBF(const CTransaction &tx)
Definition: rbf.cpp:9
Definition: rbf.h:10
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: txmempool.h:64
bool exists(const uint256 &hash) const
Definition: txmempool.h:692
const uint256 & GetHash() const
Definition: transaction.h:303
bool CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents=true) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Try to calculate all in-mempool ancestors of entry.
Definition: txmempool.cpp:152
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:443
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:251
auto it
Definition: validation.cpp:384
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it...
Definition: txmempool.h:520