MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsRBFOptIn

Function IsRBFOptIn

src/policy/rbf.cpp:12–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include <util/rbf.h>
11
12RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
13{
14 AssertLockHeld(pool.cs);
15
16 CTxMemPool::setEntries ancestors;
17
18 // First check the transaction itself.
19 if (SignalsOptInRBF(tx)) {
20 return RBFTransactionState::REPLACEABLE_BIP125;
21 }
22
23 // If this transaction is not in our mempool, then we can't be sure
24 // we will know about all its inputs.
25 if (!pool.exists(GenTxid::Txid(tx.GetHash()))) {
26 return RBFTransactionState::UNKNOWN;
27 }
28
29 // If all the inputs have nSequence >= maxint-1, it still might be
30 // signaled for RBF if any unconfirmed parents have signaled.
31 uint64_t noLimit = std::numeric_limits<uint64_t>::max();
32 std::string dummy;
33 CTxMemPoolEntry entry = *pool.mapTx.find(tx.GetHash());
34 pool.CalculateMemPoolAncestors(entry, ancestors, noLimit, noLimit, noLimit, noLimit, dummy, false);
35
36 for (CTxMemPool::txiter it : ancestors) {
37 if (SignalsOptInRBF(it->GetTx())) {
38 return RBFTransactionState::REPLACEABLE_BIP125;
39 }
40 }
41 return RBFTransactionState::FINAL;
42}
43
44RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx)
45{

Callers 3

FUZZ_TARGET_INITFunction · 0.85
blockchain.cppFile · 0.85
isRBFOptInMethod · 0.85

Calls 6

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

Tested by 1

FUZZ_TARGET_INITFunction · 0.68