| 22 | #include <compare> |
| 23 | |
| 24 | RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) |
| 25 | { |
| 26 | AssertLockHeld(pool.cs); |
| 27 | |
| 28 | // First check the transaction itself. |
| 29 | if (SignalsOptInRBF(tx)) { |
| 30 | return RBFTransactionState::REPLACEABLE_BIP125; |
| 31 | } |
| 32 | |
| 33 | // If this transaction is not in our mempool, then we can't be sure |
| 34 | // we will know about all its inputs. |
| 35 | if (!pool.exists(tx.GetHash())) { |
| 36 | return RBFTransactionState::UNKNOWN; |
| 37 | } |
| 38 | |
| 39 | // If all the inputs have nSequence >= maxint-1, it still might be |
| 40 | // signaled for RBF if any unconfirmed parents have signaled. |
| 41 | const auto& entry{*Assert(pool.GetEntry(tx.GetHash()))}; |
| 42 | auto ancestors{pool.CalculateMemPoolAncestors(entry)}; |
| 43 | |
| 44 | for (CTxMemPool::txiter it : ancestors) { |
| 45 | if (SignalsOptInRBF(it->GetTx())) { |
| 46 | return RBFTransactionState::REPLACEABLE_BIP125; |
| 47 | } |
| 48 | } |
| 49 | return RBFTransactionState::FINAL; |
| 50 | } |
| 51 | |
| 52 | RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx) |
| 53 | { |
no test coverage detected