From 8fa2936b34fda9c0bea963311fa80a04b4bf5867 Mon Sep 17 00:00:00 2001 From: glozow Date: Thu, 28 Oct 2021 13:25:23 +0100 Subject: [PATCH] [validation] re-introduce bool for whether a transaction is RBF This bool was originally part of Workspace and was removed in #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. --- src/validation.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 841aaebe0e019..c32309b21497b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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_rbf{false}; }; bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws) @@ -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_rbf = !setConflicts.empty(); + if (m_rbf) { 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