mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 02:33:28 +01:00
refactor: Add IsRBFOptInEmptyMempool
Co-authored-by: John Newbery <jonnynewbs@gmail.com>
This commit is contained in:
@@ -276,8 +276,9 @@ public:
|
||||
}
|
||||
RBFTransactionState isRBFOptIn(const CTransaction& tx) override
|
||||
{
|
||||
LOCK(::mempool.cs);
|
||||
return IsRBFOptIn(tx, ::mempool);
|
||||
if (!m_node.mempool) return IsRBFOptInEmptyMempool(tx);
|
||||
LOCK(m_node.mempool->cs);
|
||||
return IsRBFOptIn(tx, *m_node.mempool);
|
||||
}
|
||||
bool hasDescendantsInMempool(const uint256& txid) override
|
||||
{
|
||||
|
||||
@@ -36,3 +36,9 @@ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
|
||||
}
|
||||
return RBFTransactionState::FINAL;
|
||||
}
|
||||
|
||||
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx)
|
||||
{
|
||||
// If we don't have a local mempool we can only check the transaction itself.
|
||||
return SignalsOptInRBF(tx) ? RBFTransactionState::REPLACEABLE_BIP125 : RBFTransactionState::UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@ enum class RBFTransactionState {
|
||||
// This involves checking sequence numbers of the transaction, as well
|
||||
// as the sequence numbers of all in-mempool ancestors.
|
||||
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
|
||||
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);
|
||||
|
||||
#endif // BITCOIN_POLICY_RBF_H
|
||||
|
||||
Reference in New Issue
Block a user