Skip to content
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

close&sweep directly to a specific address #4

Open
Overtorment opened this issue Jul 12, 2021 · 0 comments
Open

close&sweep directly to a specific address #4

Overtorment opened this issue Jul 12, 2021 · 0 comments

Comments

@Overtorment
Copy link
Member

Overtorment commented Jul 12, 2021

a) we always pull that method, so no matter when we send it, gotta override KeysInterface 's get_shutdown_pubkey and return your own public key at that time. That interface may change to a (native-segwit-only) script soon-ish, but other lightning nodes need to upgrade for us to be able to do that.
b) we can do it later or earlier, currently we fetch the public key at channel open no matter what, but then can optionally send it to the peer later based on https://docs.rs/lightning/0.0.99/lightning/util/config/struct.ChannelConfig.html#structfield.commit_upfront_shutdown_pubkey will fix that to pull the public key at shutdown-time instead.
Matt Corallo  5 minutes ago
In any case, create your own KeysInterface implementation, with each method just calling a KeysManager.as_KeysInterface() method, except get_shutdown_pubkey where you provide the public key you want to pay out to (via p2wpkh).




Matt Corallo  5 minutes ago
Then, set ChannelConfig.commit_upfront_shutdown_pubkey to false when you open the channel/create your ChannelManager.

Matt Corallo  4 minutes ago
Then, in 0.0.100, LDK will call get_shutdown_pubkey only when the channel is about to be closed and use the public key provided there (as p2wpkh)

Matt Corallo  2 minutes ago
Note that if you do this, you must ignore SpendableOutputs  objects of which are just a SpendableOutputDescriptor::StaticOutput where the output's script_pubkey is the public key you provided

Matt Corallo  1 minute ago
Note that you can ignore all SpendableOutputDescriptor::StaticOutput objects if you also override the get_destination_script() method in KeysInterface
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

1 participant