Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# Mempool Replacements3## Current Replace-by-Fee Policy5A transaction conflicts with an in-mempool transaction ("directly conflicting transaction") if they6spend one or more of the same inputs. A transaction may conflict with multiple in-mempool7transactions.9A transaction ("replacement transaction") may replace its directly conflicting transactions and10their in-mempool descendants (together, "original transactions") if, in addition to passing all11other consensus and policy rules, each of the following conditions are met:131. (Removed)152. (Removed)173. The replacement transaction pays an absolute fee of at least the sum paid by the original18transactions.20*Rationale*: Only requiring the replacement transaction to have a higher feerate could allow an21attacker to bypass node minimum relay feerate requirements and cause the network to repeatedly22relay slightly smaller replacement transactions without adding any more fees. Additionally, if23any of the original transactions would be included in the next block assembled by an economically24rational miner, a replacement policy allowing the replacement transaction to decrease the absolute25fees in the next block would be incentive-incompatible.274. The additional fees (difference between absolute fee paid by the replacement transaction and the28sum paid by the original transactions) pays for the replacement transaction's bandwidth at or29above the rate set by the node's incremental relay feerate. For example, if the incremental relay30feerate is 0.1 satoshi/vB and the replacement transaction is 500 virtual bytes total, then the31replacement pays a fee at least 50 satoshis higher than the sum of the original transactions.33*Rationale*: Try to prevent DoS attacks where an attacker causes the network to repeatedly relay34transactions each paying a tiny additional amount in fees, e.g. just 1 satoshi.365. The number of distinct clusters corresponding to conflicting transactions does not exceed 100.38*Rationale*: Limit CPU usage required to update the mempool for so many transactions being39removed at once.416. The feerate diagram of the mempool must be strictly improved by the replacement transaction.43*Rationale*: This ensures that block fees in all future blocks will go up44after the replacement (ignoring tail effects at the end of a block).47## History49* Opt-in full replace-by-fee (without inherited signaling) honoured in mempool and mining as of50**v0.12.0** ([PR 6871](https://github.com/bitcoin/bitcoin/pull/6871)).52* [BIP125](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki) defined based on53Bitcoin Core implementation.55* The incremental relay feerate used to calculate the required additional fees is distinct from56`-minrelaytxfee` and configurable using `-incrementalrelayfee`57([PR #9380](https://github.com/bitcoin/bitcoin/pull/9380)).59* RBF enabled by default in the wallet GUI as of **v0.18.1** ([PR60#11605](https://github.com/bitcoin/bitcoin/pull/11605)).62* Full replace-by-fee enabled as a configurable mempool policy as of **v24.0** ([PR63#25353](https://github.com/bitcoin/bitcoin/pull/25353)).65* Full replace-by-fee is the default policy as of **v28.0** ([PR #30493](https://github.com/bitcoin/bitcoin/pull/30493)).67* Signaling for replace-by-fee is no longer required as of [PR 30592](https://github.com/bitcoin/bitcoin/pull/30592).69* The incremental relay feerate default is 0.1sat/vB ([PR #33106](https://github.com/bitcoin/bitcoin/pull/33106)).71* Feerate diagram policy enabled in conjunction with switch to cluster mempool as of **v31.0**.
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.