Skip to content

Don't fail send_all retaining reserves for 0 channels #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented May 16, 2025

Fixes #539.

Previouly, OnchainPayment::send_all_to_address would fail in the
retain_reserves mode if the maintained reserves were below the dust
limit. Most notably this would happen if we had no channels open at all.

Here, we fix this by simply falling back to the draining case (not
considering reserves) if the anchor reserves are below dust. We also add
a unit test that would have caught this regression in the first place.

Note: Github diff really messes up the first commit which is mostly adding an if and re-indenting the previous codeblock. It's best reviewed with git show --color-moved --ignore-all-space

tnull added 2 commits May 16, 2025 15:20
Previouly, `OnchainPayment::send_all_to_address` would fail in the
`retain_reserves` mode if the maintained reserves were below the dust
limit. Most notably this would happen if we had no channels open at all.

Here, we fix this by simply falling back to the draining case (not
considering reserves) if the anchor reserves are below dust. We also add
a unit test that would have caught this regression in the first place.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented May 16, 2025

👋 Thanks for assigning @jkczyz 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.

We create temporary transactions for fee estimation purposes. Doing this might
advance the descriptor state though. So here we call `cancel_tx` to tell
the wallet we no longer intend to broadcast the temporary transactions.
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.

send_all_to_address with retain_reserves creates 0 amount output
2 participants