Skip to content

Keep reserved change addresses marked during fee estimates - #1096

Open
jkczyz wants to merge 1 commit into
lightningdevkit:mainfrom
jkczyz:2026-09-fee-estimate-change-address
Open

Keep reserved change addresses marked during fee estimates#1096
jkczyz wants to merge 1 commit into
lightningdevkit:mainfrom
jkczyz:2026-09-fee-estimate-change-address

Conversation

@jkczyz

@jkczyz jkczyz commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Estimating the maximum funding amount, the maximum splice-in amount, or a send-all payment builds a temporary drain transaction whose anchor reserve output pays to the wallet's first internal address, then cancels it as though it were a real transaction. A drain transaction never reserves a change address, so the cancel has nothing of its own to undo and instead clears the usage mark on that internal address. If a pending channel funding or splice contribution had reserved the same address for its change, the wallet could hand it out again until the pending transaction is synced, causing address reuse.

Fee estimates now leave the wallet untouched, since BDK neither marks an address nor locks an input for a transaction that drains to a fixed script.

Estimating the maximum funding amount, the maximum splice-in amount, or
a send-all payment builds a temporary drain transaction whose anchor
reserve output pays to the wallet's first internal address, then cancels
it as though it were a real transaction. A drain transaction never
reserves a change address, so the cancel has nothing of its own to undo
and instead clears the usage mark on that internal address. If a pending
channel funding or splice contribution had reserved the same address for
its change, the wallet could hand it out again until the pending
transaction is synced, causing address reuse.

Fee estimates now leave the wallet untouched, since BDK neither marks an
address nor locks an input for a transaction that drains to a fixed
script.

Co-Authored-By: Claude <noreply@anthropic.com>
@ldk-reviews-bot

ldk-reviews-bot commented Sep 11, 2026

Copy link
Copy Markdown

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz
jkczyz requested a review from tnull September 11, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants