mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
refactor: Add IsRBFOptInEmptyMempool
Co-authored-by: John Newbery <jonnynewbs@gmail.com>
This commit is contained in:
parent
df75e9f3ee
commit
fa831684e5
3 changed files with 10 additions and 2 deletions
|
@ -276,8 +276,9 @@ public:
|
||||||
}
|
}
|
||||||
RBFTransactionState isRBFOptIn(const CTransaction& tx) override
|
RBFTransactionState isRBFOptIn(const CTransaction& tx) override
|
||||||
{
|
{
|
||||||
LOCK(::mempool.cs);
|
if (!m_node.mempool) return IsRBFOptInEmptyMempool(tx);
|
||||||
return IsRBFOptIn(tx, ::mempool);
|
LOCK(m_node.mempool->cs);
|
||||||
|
return IsRBFOptIn(tx, *m_node.mempool);
|
||||||
}
|
}
|
||||||
bool hasDescendantsInMempool(const uint256& txid) override
|
bool hasDescendantsInMempool(const uint256& txid) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,3 +36,9 @@ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
|
||||||
}
|
}
|
||||||
return RBFTransactionState::FINAL;
|
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
|
// This involves checking sequence numbers of the transaction, as well
|
||||||
// as the sequence numbers of all in-mempool ancestors.
|
// as the sequence numbers of all in-mempool ancestors.
|
||||||
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
|
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
|
||||||
|
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);
|
||||||
|
|
||||||
#endif // BITCOIN_POLICY_RBF_H
|
#endif // BITCOIN_POLICY_RBF_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue