AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 41 Bitcoin

Merge bitcoin/bitcoin#36040: Wallet: Don't backdate locktime rbf

Public commit record

What the developer wrote

Authored by Ava Chow

100/100 · Strong
Merge bitcoin/bitcoin#36040: Wallet: Don't backdate locktime rbf

596dd6fd88efe92133a34a0ba8d00f5f369a4bfd Test: bumpfee does not backdate the locktime (Biel)
b1ddb7d6857668c82efefebe94f6ba224f71ab4a Wallet: Do not allow bumpfee to backdate the replacement transaction locktime (Biel)

Pull request description:

Closes https://github.com/bitcoin/bitcoin/issues/26526

Currently, in Bitcoin Core, given an original transaction A and its replacement B, we refer to **backdating** when the locktime of A is higher than the locktime of B (`A.locktime > B.locktime`). This can happen because Bitcoin Core enables **anti-fee-sniping** by default, which sets the transaction's locktime to the current block height. For privacy, 10% of the time, it instead sets a different locktime, randomly chosen between the current height and the current height minus 100 blocks. This can lead into having a replacement of a transaction with a locktime older than its original transaction. This is unrealistics and can be used as a wallet fingerprint.

You can find a functional test to reproduce the behaviour mentioned [here](https://gist.github.com/Bicaru20/9afcb878dd103369255cd81cffac86ba)

The approach proposed in this PR adds a new parameter to `CoinControl` to keep track of the previous locktime in the case of a `bumpfee`. We then pass this parameter to the DiscourageFeeSniping function through a new parameter, `minimum_height`, whose default value is set to 0.

<details>
<summary>Alternative approach:</summary>
Since the locktime of the new transaction is 0, we also considered setting it to the previous locktime value and then, inside `DiscourageFeeSniping`, saving the previous locktime and setting the transaction's locktime to the block height before applying any of the backdating logic. This way, we could avoid passing a new parameter to the function. We ultimately decided not to go with this approach, as it makes the code more difficult to follow.
</details>

The only RPC that is affected by this changes is `bumpfee`.

The pr also includes a functional test in `wallet_bumpfee.py` to test that when replacing a transation using `bumpfee` the locktime is not backdated.

<details>
<summary>We also conducted a small analysis to see how many the backdating in RBF transactions actually happen.</summary>
We have data on the replaced transactions from 2025-05-01 to 2026-06-01. With that we have been able to detect this many backdatings:
<img width="1782" height="891" alt="image" src="https://github.com/user-attachments/assets/1d2a83d5-aa61-4850-82e5-cb434b9ee958" />

_We took the date of the last transaction of the
replacement chain (A replacement chain are all the transactions that replace themselves)_

In total we have over 1,000,000 rbf transactions, but we see that on average there are only about 200-300 hundred replaccements backdating per week. Looking at the percentages we see that on average is less than 2% of all the transactions that have been replaced.

So, it is clear that backdating in replacement transactions is unusual. However, the few transactions that do exhibit backdating are easily fingerprintable as having been replaced using `bumpfee` in Bitcoin Core or Electrum.

</details>

ACKs for top commit:
achow101:
ACK 596dd6fd88efe92133a34a0ba8d00f5f369a4bfd
polespinasa:
ACK 596dd6fd88efe92133a34a0ba8d00f5f369a4bfd
nervana21:
ACK 596dd6fd88efe92133a34a0ba8d00f5f369a4bfd

Tree-SHA512: ce4c6a6d9e84c7f1412f6a3452909109ffc790465c5fd8f799433a70d4b59187b4160defb8e9e1891686457824575c499f36073f3d7a4ba048527735c515e675
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This change fixes a privacy leak in Bitcoin Core's wallet. When users used the 'bumpfee' feature to replace a transaction with a higher fee, the replacement could sometimes end up with an older 'locktime' than the original transaction. This unusual pattern could be spotted by anyone observing the blockchain and used as a fingerprint to identify transactions created by Bitcoin Core (or Electrum). The fix ensures the replacement's locktime is never older than the original's, removing that tell.

Recommended action

This is a privacy-hardening fix; operators and users relying on bumpfee should upgrade to a release containing this commit. No immediate emergency response is required because funds are not directly at risk, but wallet fingerprinting can degrade long-term privacy.

Security signals we found

01

Privacy/fingerprinting issue in wallet transaction creation

02

Replacement transaction locktime can be lower than original transaction locktime

03

Anti-fee-sniping random backdating can produce identifiable on-chain pattern

04

Fix adds minimum locktime constraint passed through CoinControl

05

Functional test confirms bumped locktime is not backdated below original

Risk score

Why this scored 41/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 10/15
Affected reach 6/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.