MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / IsRBFOptIn

Function IsRBFOptIn

src/policy/rbf.cpp:24–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#include <compare>
23
24RBFTransactionState 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
52RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx)
53{

Callers 3

rbf.cppFile · 0.85
mempool.cppFile · 0.85
isRBFOptInMethod · 0.85

Calls 6

SignalsOptInRBFFunction · 0.85
GetTxMethod · 0.80
existsMethod · 0.45
GetHashMethod · 0.45
GetEntryMethod · 0.45

Tested by

no test coverage detected