CPFP vs Transaction Cancelation: What's the Deal?

11 replies 153 views
bear_maxiSenior Member
Posts: 349 · Reputation: 1145
#1May 27, 2026, 11:31 AM
So, let's picture a situation where two people, a Sender and a Receiver, agreed on a transaction. The Sender kicks things off, but then the transaction stumbles because the network is super congested, leaving it hanging for ages. Frustrated, the Receiver decides to implement CPFP with a fee that should help confirm both transactions. But meanwhile, the Sender goes ahead and double-spends to completely cancel out their original transaction. So, could it be possible for both transactions to end up being confirmed? If so, what would happen to the CPFP fee if the double-spend actually goes through and the CPFP gets dropped later?
2 Reply Quote Share
SwiftMinerSenior Member
Posts: 259 · Reputation: 1036
#2May 27, 2026, 03:12 PM
Nahhh.. once you cancel a transaction most wallets automatically use a high fee to ensure it gets confirmed almost immediately. And that already means the coin will be marked as spent on the network. That same coin cannot be respent. However assuming the cancellation was not not confirmed before the CPFP, then the CPFP will be validated leaving the cancellation hash invalid. Every transaction must have an origin and that's why miners have to validate a transaction before they can confirm it else we'll have countless counterfeit coins or people will just double spend to multiply their coins. The idea is one must get confirmed first which is the one with the bigger fees. And that's what determines which will be invalid.
4 Reply Quote Share
humbleledgerLegendary
Posts: 1027 · Reputation: 6554
#3May 27, 2026, 08:23 PM
No. When it comes to CPFP vs RBF, miners will most likely select the combination that pays the highest fee per vbyte. If it's the same, they'll just pick one.
3 Reply Quote Share
cryptobridgeSenior Member
Posts: 221 · Reputation: 1481
#4May 27, 2026, 10:50 PM
Logically, each transaction comes with a fee and miners are going to give priority to transaction with a high fee. Supposely the median fee is 1 sats/vbyte, the sender decided to double spend with a new transaction fee of 1.5 sats to reverse the transaction while the receiver used 10 sats/vbyte to CPFP, the receiver will likely get mine before the sender cancel the transaction. If the fees are the other way round, the miners prioritize transaction with high fee. The two transactions can't be confirmed at once, one will be confirmed and the other will be dropped from mempools.
5 Reply Quote Share
leo.wolfHero Member
Posts: 540 · Reputation: 2813
#5May 27, 2026, 10:55 PM
If you look at it you’re simply just saying that one UTXO or input is spent twice which is never possible, both cases you’re referring to are just replacing the main transaction and the race is for one to get confirmed first, the first to get confirmed invalidates the other transactions, you can only spend an input once. So the first to get confirmed is the right transaction which is usually based on fee rate since miners now prioritize transactions base on it. If your CPFP get confirmed first, nodes with the RBF transaction will just drop it and vice versa
4 Reply Quote Share
st4cks4tsFull Member
Posts: 149 · Reputation: 608
#6May 28, 2026, 04:20 AM
I would like to add one important nuance here. Even if one of the conflicting transactions has a higher fee, miners do not magically see all transactions at the same time. A miner can only choose between transactions that have already reached their mempool. It is entirely possible that one transaction propagated through the network and reached a miner, while the competing transaction was broadcast just moments before the block was found and simply did not reach that miner in time. Since nobody knows when the next block will be mined, this propagation risk always exists. So in practice, a miner will include either the transaction (or transaction package via CPFP) with the higher effective fee or the one that happened to reach them first. Fee rate improves your odds, but it does not eliminate the risk of losing a race between conflicting transactions.
1 Reply Quote Share
paul.stakeHero Member
Posts: 651 · Reputation: 3798
#7May 29, 2026, 03:54 AM
In addition to that, even if miners have all transactions, it's still not granted they'll pick the optimal combination that maximizes their profit. The algorithm used to select the optimal set of transactions is NP-hard. Miners pick a set of transactions that is profitable enough, but not always the most profitable. That's because picking something good enough is very often a process that finishes a lot faster than finding the best one. So, the right answer is that they'll just choose one, nearly randomly, if CPFP pays around the same as RBF:
3 Reply Quote Share
w0lf404Hero Member
Posts: 801 · Reputation: 2381
#8May 29, 2026, 05:28 AM
You probably meant RBF, not CPFP. Because you can't cancel a transaction with CPFP. Using CPFP, you can only make the transaction get confirmed faster. It's RBF that allows you to replace a transaction with a one sending the funds to yourself.
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#9May 29, 2026, 11:11 AM
There seem to be a misunderstanding on how RBF/CPFP work and how the fee is paid due this question. Let me use your example scenario to explain; From the sender side: Let's label the sender's original transaction as "Txn A1".Then "Txn A2" is his replacement transaction that aims to be included to a block instead of A1.Since both are spending the same input, only one of them can be accepted by each individual node. Nodes select based on a few factors like RBF policy of the particular node, which one it seen first, was the other txn already dropped (since you mentioned "very long time"), etc. Pools and Solo miners have their own mempool as well so they're also subjected to that, unless their method of acquiring transactions is unique. Then, from the receiver side: Aside from Txn A1, there's "Txn B" that spends Txn A1's output to bump its effective fee rate.Since he managed to create a CPFP despite the sender already replaced A1 at his end, let's assume that his node isn't aware of A2. And since it's trying to spend A1's output, it will only get relayed by nodes that has Txn A1. Now it's a "race" on which can get to a miner that will mine the next block first. With those in mind, there're two scenarios: If Txn A1 got confirmed, his CPFP Txn B can also get confirmed.But if Txn A2 got confirmed, Txn B will be dropped by nodes that has the latest block because they'll see that its parent Txn A1 is now invalid at that point. As for the fee, it's not paid up front to the miner, It's just the difference between the inputs' and outputs' total amount, they can get it when they included the transaction to their block.
1 Reply Quote Share
hodler_b34rFull Member
Posts: 121 · Reputation: 453
#10May 29, 2026, 03:44 PM
Child Pay For Parent (CPFP) costs more than Replace By Fee (RBF) and needs more conditions to use, so if it is possible, let's make your priority of using Replace By Fee in order to pump fee rate of your stuck transaction in the mempool. Bitcoin open source wallets that support replace-by-fee (RBF). Turn non-RBF transaction to RBF enabled? [TUTORIAL] Getting a low-fee transaction unstuck by creating a CPFP with Electrum. My Bitcoin transaction is not confirming, what can I do?
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#11May 29, 2026, 06:43 PM
This isn't what OP is asking, nor even relevant to the question. Please thoroughly read that "sender and recipient" scenario that he described, It isn't actually about bumping transactions but about the most probable result when that situation happened and why/how.
3 Reply Quote Share
im_lynxHero Member
Posts: 515 · Reputation: 2161
#12May 29, 2026, 11:58 PM
From my understanding of RBF and CPFP and what the OP tries to create as a scenario, the CPFP can only be created and submitted if the receiver's wallet isn't aware of the sender's replacement transaction for whatever reasons which after some seconds of propagation time seams an unlikely scenario (I don't know current average transaction propagation times, I guess it's no more than quite low two-figure seconds at max). If sender's replacement transaction is accepted in a mempool this automatically invalidates and evicts the replaced transaction from mempool. This new situation then gets propagated to other mempools. If this already happened before the CPFP could've been broadcasted, it invalidates the CPFP from the very beginning. A wallet aware of the sender's replacement transaction won't allow to create and broadcast a CPFP of the replaced and prior stuck original transaction. The other thinkable case of the CPFP transaction being broadcasted first and before the new sender's replacement transaction is of course possible. But if the new sender's replacement transaction gets accepted into a mempool, the stuck sender's original transaction gets invalidated and evicted from mempool which invalidates and evicts the CPFP transaction, too. So my take on the answer to OP is: sender's replacement and receiver's CPFP transactions can't ever co-exist in a mempool; if one of them gets confirmed and mined in a block, this automatically invalidates and discards the other in another mempool if it hasn't been discarded already. The only scenario I can think of that replacement and CPFP get both confirmed in two different fork blocks that were mined more or less simultanously by two (most likely different) miners and those miners were only aware of one of the opposing transactions, one miner had the replacement transaction, the other miner had only the CPFP transaction. Then we have a temporary chain fork which gets usually resolved by the next mined block; transactions from the abandoned forked block return to mempool or are invalidated by the winning block's confirmed transactions. Feel free to correct me if I'm wrong or misunderstood OP's initial scenario.
2 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics