![]() |
Bitcoin Core
25.99.0
P2P Digital Currency
|
#include <policy/rbf.h>
#include <consensus/amount.h>
#include <kernel/mempool_entry.h>
#include <policy/feerate.h>
#include <primitives/transaction.h>
#include <sync.h>
#include <tinyformat.h>
#include <txmempool.h>
#include <uint256.h>
#include <util/moneystr.h>
#include <util/rbf.h>
#include <limits>
#include <vector>
Go to the source code of this file.
Functions | |
RBFTransactionState | IsRBFOptIn (const CTransaction &tx, const CTxMemPool &pool) |
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) |
Get all descendants of iters_conflicting. More... | |
std::optional< std::string > | HasNoNewUnconfirmed (const CTransaction &tx, const CTxMemPool &pool, const CTxMemPool::setEntries &iters_conflicting) |
The replacement transaction may only include an unconfirmed input if that input was included in one of the original transactions. More... | |
std::optional< std::string > | EntriesAndTxidsDisjoint (const CTxMemPool::setEntries &ancestors, const std::set< uint256 > &direct_conflicts, const uint256 &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 > | PaysMoreThanConflicts (const CTxMemPool::setEntries &iters_conflicting, CFeeRate replacement_feerate, const uint256 &txid) |
Check that the feerate of the replacement transaction(s) is higher than the feerate of each of the transactions in iters_conflicting. More... | |
std::optional< std::string > | PaysForRBF (CAmount original_fees, CAmount replacement_fees, size_t replacement_vsize, CFeeRate relay_fee, const uint256 &txid) |
The replacement transaction must pay more fees than the original transactions. More... | |
std::optional<std::string> EntriesAndTxidsDisjoint | ( | const CTxMemPool::setEntries & | ancestors, |
const std::set< uint256 > & | direct_conflicts, | ||
const uint256 & | 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.
[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. |
Definition at line 116 of file rbf.cpp.
std::optional<std::string> GetEntriesForConflicts | ( | const CTransaction & | tx, |
CTxMemPool & | pool, | ||
const CTxMemPool::setEntries & | iters_conflicting, | ||
CTxMemPool::setEntries & | all_conflicts | ||
) |
Get all descendants of iters_conflicting.
Checks that there are no more than MAX_REPLACEMENT_CANDIDATES potential entries. May overestimate if the entries in iters_conflicting have overlapping descendants.
[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. |
Definition at line 56 of file rbf.cpp.
std::optional<std::string> HasNoNewUnconfirmed | ( | const CTransaction & | tx, |
const CTxMemPool & | pool, | ||
const CTxMemPool::setEntries & | iters_conflicting | ||
) |
The replacement transaction may only include an unconfirmed input if that input was included in one of the original transactions.
Definition at line 84 of file rbf.cpp.
RBFTransactionState IsRBFOptIn | ( | const CTransaction & | tx, |
const CTxMemPool & | pool | ||
) |
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.
tx | The unconfirmed transaction |
pool | The mempool, which may contain the tx |
Definition at line 21 of file rbf.cpp.
RBFTransactionState IsRBFOptInEmptyMempool | ( | const CTransaction & | tx | ) |
std::optional<std::string> PaysForRBF | ( | CAmount | original_fees, |
CAmount | replacement_fees, | ||
size_t | replacement_vsize, | ||
CFeeRate | relay_fee, | ||
const uint256 & | 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.
[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. |
Definition at line 157 of file rbf.cpp.
std::optional<std::string> PaysMoreThanConflicts | ( | const CTxMemPool::setEntries & | iters_conflicting, |
CFeeRate | replacement_feerate, | ||
const uint256 & | txid | ||
) |
Check that the feerate of the replacement transaction(s) is higher than the feerate of each of the transactions in iters_conflicting.
[in] | iters_conflicting | The set of mempool entries. |
Definition at line 131 of file rbf.cpp.