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

Feature Request: Force close from previous state #149

Closed
brh28 opened this issue Jul 22, 2024 · 10 comments
Closed

Feature Request: Force close from previous state #149

brh28 opened this issue Jul 22, 2024 · 10 comments

Comments

@brh28
Copy link

brh28 commented Jul 22, 2024

I have a node that was deleted without a backup and without a seed phrase. There's one channel on that node that I have control of the peer. What I'd like to do is broadcast a previous commitment transaction from the active node. However, the forceclose command only lets you broadcast the current state.

Whether by adding an index param to the forceclose command or by some other method, is there a way of broadcasting a previous commit state from an LND node?

@guggero
Copy link
Member

guggero commented Jul 22, 2024

I've hacked this together #150 quite quickly (haven't had time to properly test it yet). Will continue later today, but if you're adventurous, you can already give it a try.

@guggero
Copy link
Member

guggero commented Jul 22, 2024

Maybe don't use the --publish flag just yet to make sure it's picking the right update number and the balance is where it should be?

@brh28
Copy link
Author

brh28 commented Jul 22, 2024

Awesome, thank you. I'll play around with this today in a local regtest environment and report back any findings or questions.

To your knowledge, is there any risk of a node broadcasting a justice transaction against its own force close? Worst case scenario is I accidentally sweep funds to the side of the channel I don't have control of.

@guggero
Copy link
Member

guggero commented Jul 22, 2024

Cool. I hope the close TX that you need is still around in the new revocation database format... Just in case, don't update the running node to a new version just yet.

You said the node was fully deleted, right? So nothing running of it anymore? The only risk is if you used a watchtower with the deleted node. Then the watchtower will sweep the funds to an address controlled by the deleted node...

@brh28
Copy link
Author

brh28 commented Jul 22, 2024

Tested this locally on a regtest network (via Polar):

Command

chantools forceclose \
    --walletdb polar/july22/wallet.db \
    --channeldb polar/july22/channel.db \
    --singlechannel 6c046045443cbf11c00c3a79cc82b9d95eb4bc2479babb2657f579a24663d5ea:1 
    --updatenum 0

Output:

Error: commit at height 0 not available in channel DB

(I also tried a few other indexes with the same corresponding results)

Are there any usage issues you see? Or troubleshooting tips?

@guggero
Copy link
Member

guggero commented Jul 23, 2024

Hmm, that's what I was afraid of. A couple of versions ago (~ lnd 0.15) there was a database migration that freed up a lot of space from the channel state. I think those commitment transactions were part of that. Because for issuing retribution if your peer breaches, we don't need the full commitment TX, just the TXID and some keys. So I think that's why the data was removed...

Did you ever run with --db.prune-revocation on the still running node? If not, then maybe (just maybe) you're in luck and the data you need is still there... If not, I think the only option you have is to close at the current state and just get the current local balance...

@brh28
Copy link
Author

brh28 commented Jul 23, 2024

The test I ran above was on a newly created regtest node running locally with version lnd:0.17.4-beta. I look into whether the target node on mainnet has ever run --db.prune-revocation and will test the forceclose command against it.

Before doing so, I just want to confirm that no transaction (or any other effect) will be broadcast without the --publish flag. Is that correct?

@guggero
Copy link
Member

guggero commented Jul 23, 2024

Correct, as long as you don't specify the --publish, no request (GET or POST) or other data will leave the computer you're running the command on.

@guggero
Copy link
Member

guggero commented Aug 7, 2024

This isn't possible with the way commitment updates are stored in the channel DB currently...

@guggero guggero closed this as completed Aug 7, 2024
@brh28
Copy link
Author

brh28 commented Aug 9, 2024

Thanks for looking into this @guggero

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 a pull request may close this issue.

2 participants