#include <consensus/amount.h>
#include <primitives/transaction.h>
#include <threadsafety.h>
#include <txmempool.h>
#include <util/feefrac.h>
#include <compare>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <set>
#include <string>
Go to the source code of this file.
|
| RBFTransactionState | IsRBFOptIn (const CTransaction &tx, const CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs) |
| | Determine whether an unconfirmed transaction is signaling opt-in to RBF according to BIP 125 This involves checking sequence numbers of the transaction, as well as the sequence numbers of all in-mempool ancestors. More...
|
| |
| RBFTransactionState | IsRBFOptInEmptyMempool (const CTransaction &tx) |
| |
| std::optional< std::string > | GetEntriesForConflicts (const CTransaction &tx, CTxMemPool &pool, const CTxMemPool::setEntries &iters_conflicting, CTxMemPool::setEntries &all_conflicts) EXCLUSIVE_LOCKS_REQUIRED(pool.cs) |
| | Get all descendants of iters_conflicting. More...
|
| |
| std::optional< std::string > | EntriesAndTxidsDisjoint (const CTxMemPool::setEntries &ancestors, const std::set< Txid > &direct_conflicts, const Txid &txid) |
| | Check the intersection between two sets of transactions (a set of mempool entries and a set of txids) to make sure they are disjoint. More...
|
| |
| std::optional< std::string > | PaysForRBF (CAmount original_fees, CAmount replacement_fees, size_t replacement_vsize, CFeeRate relay_fee, const Txid &txid) |
| | The replacement transaction must pay more fees than the original transactions. More...
|
| |
| std::optional< std::pair< DiagramCheckError, std::string > > | ImprovesFeerateDiagram (CTxMemPool::ChangeSet &changeset) |
| | The replacement transaction must improve the feerate diagram of the mempool. More...
|
| |
◆ DiagramCheckError
| Enumerator |
|---|
| UNCALCULABLE | Unable to calculate due to topology or other reason.
|
| FAILURE | New diagram wasn't strictly superior
|
Definition at line 38 of file rbf.h.
◆ RBFTransactionState
The rbf state of unconfirmed transactions.
| Enumerator |
|---|
| UNKNOWN | Unconfirmed tx that does not signal rbf and is not in the mempool.
|
| REPLACEABLE_BIP125 | Either this tx or a mempool ancestor signals rbf.
|
| FINAL | Neither this tx nor a mempool ancestor signals rbf.
|
Definition at line 29 of file rbf.h.
◆ EntriesAndTxidsDisjoint()
| std::optional< std::string > EntriesAndTxidsDisjoint |
( |
const CTxMemPool::setEntries & |
ancestors, |
|
|
const std::set< Txid > & |
direct_conflicts, |
|
|
const Txid & |
txid |
|
) |
| |
Check the intersection between two sets of transactions (a set of mempool entries and a set of txids) to make sure they are disjoint.
- Parameters
-
| [in] | ancestors | Set of mempool entries corresponding to ancestors of the replacement transactions. |
| [in] | direct_conflicts | Set of txids corresponding to the mempool conflicts (candidates to be replaced). |
| [in] | txid | Transaction ID, included in the error message if violation occurs. |
- Returns
- error message if the sets intersect, std::nullopt if they are disjoint.
Definition at line 85 of file rbf.cpp.
◆ GetEntriesForConflicts()
Get all descendants of iters_conflicting.
Checks that there are no more than MAX_REPLACEMENT_CANDIDATES distinct clusters affected.
- Parameters
-
| [in] | iters_conflicting | The set of iterators to mempool entries. |
| [out] | all_conflicts | Populated with all the mempool entries that would be replaced, which includes iters_conflicting and all entries' descendants. Not cleared at the start; any existing mempool entries will remain in the set. |
- Returns
- an error message if the number of affected clusters would exceed MAX_REPLACEMENT_CANDIDATES, std::nullopt otherwise
Definition at line 58 of file rbf.cpp.
◆ ImprovesFeerateDiagram()
The replacement transaction must improve the feerate diagram of the mempool.
- Parameters
-
| [in] | changeset | The changeset containing proposed additions/removals |
- Returns
- error type and string if mempool diagram doesn't improve, otherwise std::nullopt.
Definition at line 127 of file rbf.cpp.
◆ IsRBFOptIn()
Determine whether an unconfirmed transaction is signaling opt-in to RBF according to BIP 125 This involves checking sequence numbers of the transaction, as well as the sequence numbers of all in-mempool ancestors.
- Parameters
-
| tx | The unconfirmed transaction |
| pool | The mempool, which may contain the tx |
- Returns
- The rbf state
Definition at line 24 of file rbf.cpp.
◆ IsRBFOptInEmptyMempool()
◆ PaysForRBF()
| std::optional< std::string > PaysForRBF |
( |
CAmount |
original_fees, |
|
|
CAmount |
replacement_fees, |
|
|
size_t |
replacement_vsize, |
|
|
CFeeRate |
relay_fee, |
|
|
const Txid & |
txid |
|
) |
| |
The replacement transaction must pay more fees than the original transactions.
The additional fees must pay for the replacement's bandwidth at or above the incremental relay feerate.
- Parameters
-
| [in] | original_fees | Total modified fees of original transaction(s). |
| [in] | replacement_fees | Total modified fees of replacement transaction(s). |
| [in] | replacement_vsize | Total virtual size of replacement transaction(s). |
| [in] | relay_fee | The node's minimum feerate for transaction relay. |
| [in] | txid | Transaction ID, included in the error message if violation occurs. |
- Returns
- error string if fees are insufficient, otherwise std::nullopt.
Definition at line 100 of file rbf.cpp.
◆ MAX_REPLACEMENT_CANDIDATES
| constexpr uint32_t MAX_REPLACEMENT_CANDIDATES {100} |
|
staticconstexpr |