-
Notifications
You must be signed in to change notification settings - Fork 133
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
Conversation
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).
19d9072
to
a4e894a
Compare
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.
a4e894a
to
d56be62
Compare
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.
d56be62
to
0fcb312
Compare
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🕍
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.