Skip to content

Bug / Feature (?) Static Loop in address cannot be filled by lncli closechannel #923

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
TrezorHannes opened this issue Apr 21, 2025 · 7 comments
Assignees

Comments

@TrezorHannes
Copy link

lncli closechannel --delivery_addr allows to define an address to send the remaining funds to upon a channel-close.

Considered the idea to have my recent channel-close all go to the static loop in address failed, due to the following error:

lncli closechannel --chan_point ab176bce1b844a6394ababb46c5446673ff5e697927ac2f446bffaf73f6e853e:2 --delivery_addr bc1p5548p39cn67qxse3lrwtducjvxn5tg0gywfpszy6404j4r
m55hys2y45yw --sat_per_vbyte 3
[lncli] rpc error: code = Unknown desc = unable to parse addr for channel ab176bce1b844a6394ababb46c5446673ff5e697927ac2f446bffaf73f6e853e:2: unable to fetch internal key: expected pubkey addr, got <nil>

so apparently lncli errors out because of the defined static delivery address, since it worked without that parameter.

Doublechecked the address twice:

litloop static s
{
    "static_address": "bc1p5548p39cn67qxse3lrwtducjvxn5tg0gywfpszy6404j4rm55hys2y45yw"

So unsure if it's a bug or a missing feature, however my suggestion would be to ensure that lncli can fill a static loop in address on coop-channel closures.

@starius
Copy link
Collaborator

starius commented Apr 21, 2025

Hey! Thanks for reporting this!
What is your version of LND? (lncli version).

@starius starius self-assigned this Apr 21, 2025
@TrezorHannes
Copy link
Author

Sure thing!

admin@debian-nuc:~$ lnd --version
lnd version 0.18.5-beta commit=v0.18.5-beta
admin@debian-nuc:~$ litloop --version
loop version 0.29.0-beta commit=v0.29.0-beta
admin@debian-nuc:~$ lncli --version
lncli version 0.18.5-beta commit=v0.18.5-beta

@TrezorHannes
Copy link
Author

TrezorHannes commented Apr 21, 2025

Notworthy addition, I haven't tested, but this might be a critical to check upfront whether
lncli open --close_address has a similar bug or missing feature. I first thought about just adding this, but now would worry that it creates serious issues on closing that channel.

starius added a commit to starius/lnd that referenced this issue Apr 21, 2025
An address imported using ImportTapscript doesn't provide a private key
so it can't satisfy waddrmgr.ManagedPubKeyAddress interface. So we don't
return an error for imported addresses.
Fix lightninglabs/loop#923
@starius
Copy link
Collaborator

starius commented Apr 21, 2025

I'm working on the fix. Please don't deploy yet.

starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
An address imported using ImportTapscript doesn't provide a private key
so it can't satisfy waddrmgr.ManagedPubKeyAddress interface. So we don't
return an error for imported addresses.
Fix lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
Make sure that an address imported to LND via ImportTapscript or ImportPublicKey
can be used as a delivery address in coop close.

New test cases:
 - P2TR address imported with ImportTapscript
 - P2TR address imported with ImportPublicKey
 - P2WPKH address imported with ImportPublicKey

Safeguard against lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
An address imported using ImportTapscript doesn't provide a private key
so it can't satisfy waddrmgr.ManagedPubKeyAddress interface. So we don't
return an error for imported addresses.
Fix lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
Make sure that an address imported to LND via ImportTapscript or ImportPublicKey
can be used as a delivery address in coop close.

New test cases:
 - P2TR address imported with ImportTapscript
 - P2TR address imported with ImportPublicKey
 - P2WPKH address imported with ImportPublicKey

Safeguard against lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
An address imported using ImportTapscript doesn't provide a private key
so it can't satisfy waddrmgr.ManagedPubKeyAddress interface. So we don't
return an error for imported addresses.
Fix lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 22, 2025
Make sure that an address imported to LND via ImportTapscript or ImportPublicKey
can be used as a delivery address in coop close.

New test cases:
 - P2TR address imported with ImportTapscript
 - P2TR address imported with ImportPublicKey
 - P2WPKH address imported with ImportPublicKey

Safeguard against lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 23, 2025
Make sure that an address imported to LND via ImportTapscript or ImportPublicKey
can be used as a delivery address in coop close.

New test cases:
 - P2TR address imported with ImportTapscript
 - P2TR address imported with ImportPublicKey
 - P2WPKH address imported with ImportPublicKey

Safeguard against lightninglabs/loop#923
starius added a commit to starius/lnd that referenced this issue Apr 23, 2025
Make sure that an address imported to LND via ImportTapscript or ImportPublicKey
can be used as a delivery address in coop close.

New test cases:
 - P2TR address imported with ImportTapscript
 - P2TR address imported with ImportPublicKey
 - P2WPKH address imported with ImportPublicKey

Safeguard against lightninglabs/loop#923
@starius starius reopened this Apr 23, 2025
@starius
Copy link
Collaborator

starius commented Apr 23, 2025

The fix was just merged to LND master. It is expected to be included to 0.19.0 release. Reopening the issue for now, until it is released and confirmed.

@starius
Copy link
Collaborator

starius commented Apr 26, 2025

Tested lnd 0.19.0-beta.rc3. Managed to close a channel to a static address.

@TrezorHannes
Copy link
Author

Great, thank you @starius . I'll wait rc3 to mature a little more and try myself, too.

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

No branches or pull requests

2 participants