Skip to content

Conversation

@gregorydemay
Copy link
Contributor

@gregorydemay gregorydemay commented Jan 14, 2026

Follow-up on #8214 to ensure the fee rate of a replacement transaction always increases. Although not a requirement of BIP-125, this constraint is actually enforced by Dogecoin and Bitcoin miners and is part of the implementation referenced in the BIP

Replaces transactions already in the mempool if a new transaction seen with a higher fee, specifically both a higher fee per KB and a higher absolute fee.

This PR ensures this by

  1. Recording the effective fee rate of a sent transaction instead of the initially estimated fee rate. The effective fee rate may be higher than the estimated one due the encoded signatures of the sent transaction requiring potentially less bytes than what was estimated (DER encoding of signatures is not constant size). This ensures that adding the relay fee for the replacement transaction does indeed increase the fee rate of the replacement transaction.
  2. Rounding the estimated fee up to ensure that the effective fee rate is always at least the estimated one.

@github-actions github-actions bot added the fix label Jan 14, 2026
@gregorydemay gregorydemay marked this pull request as ready for review January 16, 2026 13:15
@gregorydemay gregorydemay requested a review from a team January 16, 2026 13:15
@github-actions github-actions bot added the @defi label Jan 16, 2026
Copy link
Contributor

@mducroux mducroux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @gregorydemay. LGTM!

Copy link
Member

@ninegua ninegua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks

@gregorydemay gregorydemay added this pull request to the merge queue Jan 20, 2026
Merged via the queue into master with commit 5490d8b Jan 20, 2026
37 checks passed
@gregorydemay gregorydemay deleted the gdemay/DEFI-2571-fix-rbf-fee-rate branch January 20, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants