| 15 | } |
| 16 | |
| 17 | RBFTransactionState IsRBFOptIn(const CTransaction &tx, CTxMemPool &pool) |
| 18 | { |
| 19 | AssertLockHeld(pool.cs); |
| 20 | |
| 21 | CTxMemPool::setEntries setAncestors; |
| 22 | |
| 23 | // First check the transaction itself. |
| 24 | if (SignalsOptInRBF(tx)) { |
| 25 | return RBFTransactionState::REPLACEABLE_BIP125; |
| 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())) { |
| 31 | return RBFTransactionState::UNKNOWN; |
| 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())) { |
| 43 | return RBFTransactionState::REPLACEABLE_BIP125; |
| 44 | } |
| 45 | } |
| 46 | return RBFTransactionState::FINAL; |
| 47 | } |
no test coverage detected