lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Restoring a 10h old data, caused channels in indefinite stateis recovery possible? Version 0.5.2

Open MykelSIlver opened this issue 7 years ago • 16 comments

Background

Like issue #2578, but @halseth stated:

The next version of LND will make sure this cannot be done for channels that have had their state lost.

More a general question than a bug, and this is an exceptional circumstance.

Your environment

  • version of lnd lnd version 0.5.2-beta commit=v0.5.2-beta
  • which operating system (uname -a on *Nix) Linux 4.19.5 #24 SMP PREEMPT Mon Feb 18 05:24:26 UTC 2019 aarch64 GNU/Linux
  • version of bitcoind Bitcoin Core Daemon version v0.17.1

Steps to reproduce

Because of a crash a I had to restore a backup from 10 hours earlier. No tx were done during this period. However six channel close channel transactions were made during the crash causing the channels an indefinite state after restoring the old backup.

Funds lost:

About 1500 euro (0,44945732 BTC)

The following channels are in an indefinite state. (1) Channelpoint: b06ad896e955ab3fd92a870eafdac61ab300226492edcc800be2c27626778211

I can see the transaction Funds are moved into this unspend address

This is my address! But because of the restore of the old backup my node is not able to see this. How can I fix this?

Other channels in an indefinite state are: (2) Channelpoint: ca59f20c8a371678c4e2abaab4fbc0123e864cb2d39c0391c12afb120174b9b3 (3) Channelpoint: 4be8b1fd780739f20901d6bb0a6f3e17510026efbcf6b62f051463fa32dcb312 (4) Channelpoint: f3665b0c3c07cc0946f0eb37cf40e595f3deaac34c4bd7c6f1f4b1929880db08 (5) Channelpoint: b8e7a58656a00b85280a97a87e7f5455392dedefc7bb3089813d90b971ff9473 (6) Channelpoint: b06ad896e955ab3fd92a870eafdac61ab300226492edcc800be2c27626778211

Again I made this new issue because I read that @halseth stated:

The next version of LND will make sure this cannot be done for channels that have had their state lost. Well, I am using the 0.5.2 version of the lnd daemon, which is the next version.....

So is there a change that after a while my pending waiting_close_channels channels in the indefinite state will be processed at a certain time?

Or are in my case the funds lost forever?

Thanks in advance

MykelSIlver avatar Mar 11 '19 21:03 MykelSIlver

You should never restore from an out dated state. If you did and closed those channels out, then you may have lost those funds.

No tx were done during this period Fee updates can still happen automatically. By next version he meant 0.6 not 0.5.2.

Roasbeef avatar Mar 12 '19 01:03 Roasbeef

You can also look at lncli closedchannels to see how the channels were closed. If the remote peer detected the "local data loss mode", then if they're lnd nodes 0.5.2 and beyond, they'll send you the data to recover those funds. If they aren't (or another implementation all together), then they may not.

Roasbeef avatar Mar 12 '19 01:03 Roasbeef

You can also look at lncli closedchannels to see how the channels were closed. If the remote peer detected the "local data loss mode", then if they're lnd nodes 0.5.2 and beyond, they'll send you the data to recover those funds. If they aren't (or another implementation all together), then they may not.

When I issue lncli closedchannels nothing appears. Only lncli pendingchannels lists those channels in the waiting_close_channels section.

MykelSIlver avatar Mar 12 '19 02:03 MykelSIlver

You should never restore from an out dated state. If you did and closed those channels out, then you may have lost those funds.

No tx were done during this period Fee updates can still happen automatically. By next version he meant 0.6 not 0.5.2.

The other party did close the channels. Not me. Makes that a difference?

MykelSIlver avatar Mar 12 '19 02:03 MykelSIlver

If the remote peer detected the "local data loss mode", then if they're lnd nodes 0.5.2 and beyond, they'll send you the data to recover those funds. If they aren't (or another implementation all together), then they may not.

So the remote peer also have to have version 0.5.2 and beyond?

MykelSIlver avatar Mar 12 '19 02:03 MykelSIlver

Is it safe to run dropwtxmgr to do a rescan on the 0.5.2. lnd wallet database? Can this solve my problem?

MykelSIlver avatar Mar 12 '19 11:03 MykelSIlver

So it makes no sense to make backups. When something happens, you always restore an old state (backups are at least some hours old). When nodes close channels when your node is offline, and this is the case when you restore the backup, then those funds are lost.

MykelSIlver avatar Mar 12 '19 16:03 MykelSIlver

Yes, making regular disk backups make no sense for LN nodes.

What is likely the case here is that the channels that are in the "waiting_close" section are to nodes without data loss protection.... and most likely lost :/

For the other channel, how do you know it is your address? Running droptxmanager to rescan (or start a new node from your seed) should restore it then.

halseth avatar Mar 12 '19 18:03 halseth

Thanks for your reply. Nodes in my waiting_close section are pretty big and known and famous ones: yalls.org, ACINQ, 1ML.com node ALPHA. So maybe they run the most up to date daemon. But a restart of my daemon gives me little hope:

ChannelPoint(b06ad896e955ab3fd92a870eafdac61ab300226492edcc800be2c27626778211:0) has status Unknown(00000110), won't start.
ChannelPoint(ca59f20c8a371678c4e2abaab4fbc0123e864cb2d39c0391c12afb120174b9b3:0) has status Unknown(00000110), won't start.
ChannelPoint(4be8b1fd780739f20901d6bb0a6f3e17510026efbcf6b62f051463fa32dcb312:0) has status Unknown(00000110), won't start.
Unprompted commitment broadcast for ChannelPoint(f3665b0c3c07cc0946f0eb37cf40e595f3deaac34c4bd7c6f1f4b1929880db08:0) 
ChannelPoint(b8e7a58656a00b85280a97a87e7f5455392dedefc7bb3089813d90b971ff9473:1) has status Unknown(00000110), won't start.
ChannelPoint(b06ad896e955ab3fd92a870eafdac61ab300226492edcc800be2c27626778211:0) has status Unknown(00000110), won't start.

For the other channel I was making an assumption. My apologize. I'm quite upset for what has happened. For me lots of time and funds are gone. But i'm glad you give me some useful info. Maybe I'll try to start a new node from my for a restore! That's a good one!

When I start a new node from from seed, do I need to stop the old one? I rather do not take offline my node too much, but if i start a new node from my seed it maybe conflicts with the running one?

Awaiting your reply and thank you for your patience!

MykelSIlver avatar Mar 12 '19 19:03 MykelSIlver

If you're starting a new node from seed, then you should take down the old node.

Roasbeef avatar Mar 12 '19 23:03 Roasbeef

For some of those nodes, it may also be the case that they haven't fully swept their funds yet, so they haven't marked the channel in the final closing state. As for ACINQ, I don't think they fully implement the protocol reliably like we do atm.

Roasbeef avatar Mar 12 '19 23:03 Roasbeef

Thank you. For now I think I have to have some patience. I'll give it 2000 blocks time before running into conclusions and close this issue after that. Of course I keep this thread updated when things happen.

MykelSIlver avatar Mar 12 '19 23:03 MykelSIlver

If you're starting a new node from seed, then you should take down the old node.

Okay, just one thing before I begin. I take down the old node. But it is not necessary to close all channels for the current node I hope? I imagine the new node is an empty database with just only the funds?

(A voice in my head tells me this experiment does not have a big change of success because my current node also has the same seed and still receive and send funds of my current channels, but maybe i see it wrong....)

Extra info: I contacted the owner of the channelpoint yalls.org Mr. Alex Bosworth. ca59f20c8a371678c4e2abaab4fbc0123e864cb2d39c0391c12afb120174b9b3

He mailed me following

Here is what the channel looks like on my side of things

        {
            "channel_point":
"ca59f20c8a371678c4e2abaab4fbc0123e864cb2d39c0391c12afb120174b9b3:0",
            "chan_id": "617049224216838144",
            "chain_hash":
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
            "closing_tx_hash":
"e4403c908b7677749f6baf6ccde667d56709a850378c4699dce23b9b8f7cb1dc",
            "remote_pubkey":
"0373ca948ffd4cbbd08488c480aa7c43b57e9446c8ac6d3fe1cc92392e39e9eb95",
            "capacity": "16777215",
            "close_height": 566232,
            "settled_balance": "0",
            "time_locked_balance": "0",
            "close_type": "LOCAL_FORCE_CLOSE"
        }

So the channel got force closed by my node

Channel 617049224216838144 was force-closed, it was a local force close and no balance 
was settled to my side 
so there were no funds sent to my node.
If you look at the channel close, the funds went back to your key:

https://blockstream.info/tx/e4403c908b7677749f6baf6ccde667d56709a850378c4699dce23b9b8f7cb1dc?expand

If you have trouble retrieving the funds, it could be because you are
missing that channel key
I would also wait
for a bit for updates to LND (if that's what you're using)

There should be some additional fund recovery tools coming in upcoming releases

MykelSIlver avatar Mar 13 '19 07:03 MykelSIlver

This might be related to #2766 (fixes an off by one error, if you update to this, then some of the outputs may be properly swept).

Roasbeef avatar Mar 13 '19 20:03 Roasbeef

Closing for now since we've received no updates, and it appears to have been fixed by the recent PR I linked above (is part of 0.6).

Roasbeef avatar Apr 09 '19 23:04 Roasbeef

Closing for now since we've received no updates, and it appears to have been fixed by the recent PR I linked above (is part of 0.6).

lnd version 0.6.0-beta commit=v0.6-beta-rc4, which included fix #2766 did indeed solve the issue

MykelSIlver avatar Apr 12 '19 14:04 MykelSIlver