Bitcoin Core  0.19.99
P2P Digital Currency
rbf.cpp
Go to the documentation of this file.
1 // Copyright (c) 2016-2018 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 <policy/rbf.h>
6 #include <util/rbf.h>
7 
9 {
10  AssertLockHeld(pool.cs);
11 
12  CTxMemPool::setEntries setAncestors;
13 
14  // First check the transaction itself.
15  if (SignalsOptInRBF(tx)) {
17  }
18 
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  }
24 
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);
31 
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:521
RBFTransactionState IsRBFOptIn(const CTransaction &tx, const CTxMemPool &pool)
Definition: rbf.cpp:8
std::set< txiter, CompareIteratorByHash > setEntries
Definition: txmempool.h:529
bool SignalsOptInRBF(const CTransaction &tx)
Definition: rbf.cpp:9
RBFTransactionState
Definition: rbf.h:10
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: txmempool.h:65
bool exists(const uint256 &hash) const
Definition: txmempool.h:687
const uint256 & GetHash() const
Definition: transaction.h:322
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:149
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:270
AssertLockHeld(g_cs_orphans)
auto it
Definition: validation.cpp:365
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it...
Definition: txmempool.h:518