Skip to content

custom channels: more bug fixes #1030

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

Merged
merged 7 commits into from
Jul 18, 2024
Merged

custom channels: more bug fixes #1030

merged 7 commits into from
Jul 18, 2024

Conversation

guggero
Copy link
Member

@guggero guggero commented Jul 17, 2024

Fixes #1019.
Fixes #1026.

Fixes another bug found by increasing the test coverage in lightninglabs/lightning-terminal#797: When there is no balance and no HTLC going toward the initiator of a channel, we still need to create a split root output.

We then also fix an issue that we didn't send a funding error to the remote party when we couldn't fund the channel. So they had it pending until it timed out after 10 minutes (or restart) and we couldn't try again ("number of pending channel exceeds maximum").

And finally, we make sure we don't allow not yet confirmed freshly minted assets to be used for funding any asset transaction, including channel openings. To make the user experience around those unconfirmed assets we also filter them by default and add a new count and flag to the RPC interface.

A previous bug fix was wrong... In the case where an HTLC sends all the
balance from the initiator to the recipient, then the initiator has zero
balance _and_ there is no HTLC going to the initiator. So the root split
still becomes nil and we panic.
So we re-declare the rule for the case where the initiator has zero
balance: If the initiator doesn't have any balance to carry the split
root, then the very first HTLC will carry the split root. If there is no
HTLC, it means all the balance is on the recipient's side and there is
no split (hence no split root required).
guggero added 4 commits July 18, 2024 09:23
If there is no root locator defined when creating a split commitment, we
return an error instead of running into a panic later on.
If we fail to fund the channel (for example because we don't have enough
BTC or asset funds), we inform the remote about it, so they can remove
the pending channel from their in-memory state and allow us to try
again.
@guggero guggero force-pushed the channel-bug-fixes branch from a4e894a to d56be62 Compare July 18, 2024 07:23
guggero added 2 commits July 18, 2024 09:25
By default, we only want to show assets in the asset list that are ready
to be spent. So we don't want to include not yet confirmed freshly
minted assets (those are the only assets that are materialized in the
asset table while not being confirmed yet).
We add a new RPC and CLI flag that allows the user to show the assets on
explicit request.
To avoid attempting to spend freshly minted assets that haven't been
confirmed yet, we set the minimum anchor height to 1 to avoid selecting
them when funding any transaction.
@guggero guggero force-pushed the channel-bug-fixes branch from d56be62 to 0fcb312 Compare July 18, 2024 07:25
Copy link
Contributor

@gijswijs gijswijs left a comment

Choose a reason for hiding this comment

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

Codewise, lgtm.
I do have a few questions so that I can confirm my understanding.

This PR specifically fixes the issue where the split root becomes nil with commit cb19dd6.

This issue came to light with this report #1019

It also fixes the issue of poor UX that resulted in selecting unconfirmed minting transactions mentioned here #1026

The are 2 todos mentioned in that thread

As a funder, release locked/leased UTXOs if funding fails
As a recipient, do an asset specific universe sync on incoming funding request, to make sure we know at least the meta info and other issuance proof

Those 2 todos are not fixed in this PR but in PR #1029, Correct?

I want to be sure that we can close that issue.

@guggero
Copy link
Member Author

guggero commented Jul 18, 2024

@gijswijs correct, those two TODOs were already addressed in #1029.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🕍

@Roasbeef Roasbeef merged commit f5d39c9 into main Jul 18, 2024
16 checks passed
@guggero guggero deleted the channel-bug-fixes branch July 19, 2024 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[bug]: FundChannel UX improvements [bug]: In Ver lightning-terminal:v0.13.99-alpha.rc4
4 participants