@@ -605,31 +605,14 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
605605 }
606606 if (!setConflicts.count (ptxConflicting->GetHash ()))
607607 {
608- // Allow opt-out of transaction replacement by setting
609- // nSequence > MAX_BIP125_RBF_SEQUENCE (SEQUENCE_FINAL-2) on all inputs.
610- //
611- // SEQUENCE_FINAL-1 is picked to still allow use of nLockTime by
612- // non-replaceable transactions. All inputs rather than just one
613- // is for the sake of multi-party protocols, where we don't
614- // want a single party to be able to disable replacement.
615- //
616608 // Transactions that don't explicitly signal replaceability are
617609 // *not* replaceable with the current logic, even if one of their
618610 // unconfirmed ancestors signals replaceability. This diverges
619611 // from BIP125's inherited signaling description (see CVE-2021-31876).
620612 // Applications relying on first-seen mempool behavior should
621613 // check all unconfirmed ancestors; otherwise an opt-in ancestor
622614 // might be replaced, causing removal of this descendant.
623- bool fReplacementOptOut = true ;
624- for (const CTxIn &_txin : ptxConflicting->vin )
625- {
626- if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
627- {
628- fReplacementOptOut = false ;
629- break ;
630- }
631- }
632- if (fReplacementOptOut ) {
615+ if (!SignalsOptInRBF (*ptxConflicting)) {
633616 return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY, " txn-mempool-conflict" );
634617 }
635618
0 commit comments