Bitcoin Core  21.99.0
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 }
41 {
42  // If we don't have a local mempool we can only check the transaction itself.
44 }
std::deque< CInv >::iterator it
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
Definition: txmempool.h:579
RBFTransactionState IsRBFOptIn(const CTransaction &tx, const CTxMemPool &pool)
Determine whether an unconfirmed transaction is signaling opt-in to RBF according to BIP 125 This inv...
Definition: rbf.cpp:8
Either this tx or a mempool ancestor signals rbf.
bool exists(const GenTxid &gtxid) const
Definition: txmempool.h:736
Unconfirmed tx that does not signal rbf and is not in the mempool.
std::set< txiter, CompareIteratorByHash > setEntries
Definition: txmempool.h:582
bool SignalsOptInRBF(const CTransaction &tx)
Definition: rbf.cpp:9
The rbf state of unconfirmed transactions.
Definition: rbf.h:11
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: txmempool.h:78
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction &tx)
Definition: rbf.cpp:40
const uint256 & GetHash() const
Definition: transaction.h:311
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:488
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:259
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it...
Definition: txmempool.h:576
Neither this tx nor a mempool ancestor signals rbf.