Fabcoin Core  0.16.2
P2P Digital Currency
rbf.cpp
Go to the documentation of this file.
1 // Copyright (c)2016-2017 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 
8 {
9  for (const CTxIn &txin : tx.vin) {
11  return true;
12  }
13  }
14  return false;
15 }
16 
18 {
19  AssertLockHeld(pool.cs);
20 
21  CTxMemPool::setEntries setAncestors;
22 
23  // First check the transaction itself.
24  if (SignalsOptInRBF(tx)) {
26  }
27 
28  // If this transaction is not in our mempool, then we can't be sure
29  // we will know about all its inputs.
30  if (!pool.exists(tx.GetHash())) {
32  }
33 
34  // If all the inputs have nSequence >= maxint-1, it still might be
35  // signaled for RBF if any unconfirmed parents have signaled.
36  uint64_t noLimit = std::numeric_limits<uint64_t>::max();
37  std::string dummy;
38  CTxMemPoolEntry entry = *pool.mapTx.find(tx.GetHash());
39  pool.CalculateMemPoolAncestors(entry, setAncestors, noLimit, noLimit, noLimit, noLimit, dummy, false);
40 
41  for (CTxMemPool::txiter it : setAncestors) {
42  if (SignalsOptInRBF(it->GetTx())) {
44  }
45  }
47 }
RBFTransactionState
Definition: rbf.h:12
std::set< txiter, CompareIteratorByHash > setEntries
Definition: txmempool.h:534
const std::vector< CTxIn > vin
Definition: transaction.h:292
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: txmempool.h:66
indexed_transaction_set mapTx
Definition: txmempool.h:524
#define AssertLockHeld(cs)
Definition: sync.h:85
An input of a transaction.
Definition: transaction.h:61
ExecStats::duration max
Definition: ExecStats.cpp:36
indexed_transaction_set::nth_index< 0 >::type::iterator txiter
Definition: txmempool.h:526
CCriticalSection cs
Definition: txmempool.h:523
bool exists(uint256 hash) const
Definition: txmempool.h:671
RBFTransactionState IsRBFOptIn(const CTransaction &tx, CTxMemPool &pool)
Definition: rbf.cpp:17
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:465
uint32_t nSequence
Definition: transaction.h:66
bool SignalsOptInRBF(const CTransaction &tx)
Definition: rbf.cpp:7
const uint256 & GetHash() const
Definition: transaction.h:325
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:275
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
Try to calculate all in-mempool ancestors of entry.
Definition: txmempool.cpp:158