Skip to content

Commit

Permalink
[validation] re-introduce bool for whether a transaction is RBF
Browse files Browse the repository at this point in the history
This bool was originally part of Workspace and was removed in bitcoin#22539
when it was no longer needed in Finalize(). Re-introducing it because,
once again, multiple functions will need to know whether we're doing an
RBF. Member of MemPoolAccept so that we can use this to inform package
RBF in the future.
  • Loading branch information
glozow committed Oct 28, 2021
1 parent 672b962 commit ad1b504
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ class MemPoolAccept
// in-mempool conflicts; see below).
size_t m_limit_descendants;
size_t m_limit_descendant_size;

/** Whether the transaction(s) would replace any mempool transactions. If so, RBF rules apply. */
bool m_replacement_transaction{false};
};

bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
Expand Down Expand Up @@ -808,8 +811,8 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-spends-conflicting-tx", *err_string);
}


if (!setConflicts.empty()) {
m_replacement_transaction = !setConflicts.empty();
if (m_replacement_transaction) {
CFeeRate newFeeRate(nModifiedFees, nSize);
// It's possible that the replacement pays more fees than its direct conflicts but not more
// than all conflicts (i.e. the direct conflicts have high-fee descendants). However, if the
Expand Down

0 comments on commit ad1b504

Please sign in to comment.