spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.36k stars 3.07k forks source link

Unable to close an Electrum Trampoline lightning channel to get back funding, 0 can send and 0 can receive #7907

Closed charlie754 closed 2 years ago

charlie754 commented 2 years ago

I opened a trampoline routing channel with tick "Use trampoline routing (disable gossip)", the channel was opening, I choose "Electrum trampoline" with 0.01 btc, tapped "OK", the channel was opening, I tried to send money to a merchant with lightning code in "Send", it's about 0.001 btc, then tapped "pay", Electrum shown "No path found", I thought somethings wrong, so I go back to Channel tapped "Close Channel", no response, then tapped "Force close channel" repeatly for both options, then the channel goes from "opening" to "funded", then got stuck here.

My whole wallet balance gone to this fund, only "Force close channel" available which I tried couple times "request sent", how can I get back this fund?

electrum111 electurm

SomberNight commented 2 years ago

I opened a trampoline routing channel with tick "Use trampoline routing (disable gossip)", the channel was opening, I choose "Electrum trampoline" with 0.01 btc, tapped "OK", the channel was opening, I tried to send money to a merchant with lightning code in "Send", it's about 0.001 btc, then tapped "pay", Electrum shown "No path found",

When the channel is in the OPENING state, it cannot yet be used for payments. You need to wait for it to reach the OPEN state.

I thought somethings wrong, so I go back to Channel tapped "Close Channel", no response, then tapped "Force close channel" repeatly for both options

"Close channel" (i.e. mutual/cooperative close) takes a bit of time, though usually less than a minute, not sure how much you waited before trying to force-close. As to why the local force-close did not work, I am not sure...

then the channel goes from "opening" to "funded", then got stuck here.

My whole wallet balance gone to this fund, only "Force close channel" available which I tried couple times "request sent", how can I get back this fund?

Looking at your screenshots, you have not mentioned some steps you apparently took. Notably, the wallet shown in the screenshots only contains a backup of the lightning channel, and not the full channel. Maybe you restored from seed?

Anyway, with a backup your only option is to request a force-close from the remote, as shown in the screenshots, which relies on the remote node. While usually this should work too, you would have more options, including local force-close which should always work, if you had the full channel and not just a backup.

What happened to the original wallet file that you used to open the channel? Open that and try a local force-close.

In any case, please enable debug logging, and then try closing the channel again.

charlie754 commented 2 years ago

I opened a trampoline routing channel with tick "Use trampoline routing (disable gossip)", the channel was opening, I choose "Electrum trampoline" with 0.01 btc, tapped "OK", the channel was opening, I tried to send money to a merchant with lightning code in "Send", it's about 0.001 btc, then tapped "pay", Electrum shown "No path found",

When the channel is in the OPENING state, it cannot yet be used for payments. You need to wait for it to reach the OPEN state.

I thought somethings wrong, so I go back to Channel tapped "Close Channel", no response, then tapped "Force close channel" repeatly for both options

"Close channel" (i.e. mutual/cooperative close) takes a bit of time, though usually less than a minute, not sure how much you waited before trying to force-close. As to why the local force-close did not work, I am not sure...

then the channel goes from "opening" to "funded", then got stuck here. My whole wallet balance gone to this fund, only "Force close channel" available which I tried couple times "request sent", how can I get back this fund?

Looking at your screenshots, you have not mentioned some steps you apparently took. Notably, the wallet shown in the screenshots only contains a backup of the lightning channel, and not the full channel. Maybe you restored from seed?

Anyway, with a backup your only option is to request a force-close from the remote, as shown in the screenshots, which relies on the remote node. While usually this should work too, you would have more options, including local force-close which should always work, if you had the full channel and not just a backup.

What happened to the original wallet file that you used to open the channel? Open that and try a local force-close.

In any case, please enable debug logging, and then try closing the channel again.

This is an origin wallet which opened this channel. "Request force close" is the only option I can choose on Electrum beside "View transaction" as photo shown.

Unable to Request Force Close with Gossip, it will pop up 'Failed to close channel: Exception("Enable gossip first")', While disabled Gossip, then Request Force Close, it will processed "Request sent", which I have been waited for couple days already, nothing changed.

SomberNight commented 2 years ago

Looking at your screenshots, you have not mentioned some steps you apparently took. Notably, the wallet shown in the screenshots only contains a backup of the lightning channel, and not the full channel. Maybe you restored from seed?

This is an origin wallet which opened this channel.

No, this wallet file only contains a backup of the channel. This can be seen in the "Channels" tab from the lightning bolt icon being gray (there is also a tooltip if you hover-over the icon).

"Request force close" is the only option I can choose on Electrum beside "View transaction" as photo shown.

There would be more options if this was not just a backup.

Unable to Request Force Close with Gossip, it will pop up 'Failed to close channel: Exception("Enable gossip first")', While disabled Gossip, then Request Force Close, it will processed "Request sent", which I have been waited for couple days already, nothing changed.

The "Request Force Close" (remote force-close) option not working should already be fixed on master with commit https://github.com/spesmilo/electrum/commit/90dbac5a65a8b7804a5b02a6cf598588a06a71a3 (but this is not in a released version yet).

ecdsa commented 2 years ago

Note: we recently pushed this fix: 90dbac5a65 because eclair does not force close on request. I had to manually force close a channel for a user on IRC because of that

ecdsa commented 2 years ago

@charlie754 did you restore this wallet from seed after you created the channel? that would explain why we see a channel backup

charlie754 commented 2 years ago

@charlie754 did you restore this wallet from seed after you created the channel? that would explain why we see a channel backup

No, I never used Seed function. This is the only wallet I created the channel, probably I keep tapping close and force close during channel opening status, it becomes a glitch(maybe?).

ecdsa commented 2 years ago

OK, I closed it manually from the server. we need to investigate what happened, though. You did not use the export/import backup functions? Or "File -> Save Backup" from the menu?

ecdsa commented 2 years ago

Note: the log contains the following warning: unhandled event Shutdown(***,ByteVector(22 bytes, **),TlvStream(List(),List())) in state WAIT_FOR_FUNDING_CONFIRMED, and a similar line about the requested force close: unhandled event ChannelReestablish(**,1,0,**,TlvStream(List(),List())) in state WAIT_FOR_FUNDING_CONFIRMED

Maybe we should disable those options until the funding tx is confirmed.

charlie754 commented 2 years ago

OK, I closed it manually from the server. we need to investigate what happened, though. You did not use the export/import backup functions? Or "File -> Save Backup" from the menu?

The channel is still in "funded" status, I used "Save Backup" once since I did research on internet said "Save Backup" would get refund from channel, of cuz it didn't work.

For more information, this wallet was created before I reset my PC. I use the original wallet file from my old windows system then install Electrum to open it and created this "glitch" channel after the reset.

ecdsa commented 2 years ago

Ok, I think it is very likely you opened the wallet file created after doing "save backup". Do you still have the original wallet file, and can you open it?

charlie754 commented 2 years ago

Ok, I think it is very likely you opened the wallet file created after doing "save backup". Do you still have the original wallet file, and can you open it?

As mentioned, I used the original wallet from my old windows system, from Appdata/roaming folder. I'm not sure if there's any other cache on old windows for wallet. But the channel was created after the PC is reset.

ecdsa commented 2 years ago

Note: eclair did not publish its commitment tx when I tried to force-close from the command line. The log says force-closing channel at user request and then deleting database record for channelId=**, but no commitment tx was published.

charlie754 commented 2 years ago

Is there any chance to get back the fund from this channel, can it be fixed? :(

ecdsa commented 2 years ago

Yes, if you can find the wallet file from which you opened the channel. The file you show in the screenshot is not that file. It is either a backup of the wallet, or a copy of the wallet file that was made before the channel was opened.

charlie754 commented 2 years ago

Yes, if you can find the wallet file from which you opened the channel. The file you show in the screenshot is not that file. It is either a backup of the wallet, or a copy of the wallet file that was made before the channel was opened.

Negative, I tried the original and copy one, it's still show Funded as the photo shown above. I've never delete any wallet as well.

charlie754 commented 2 years ago

Fun thing is, i've founded one copy of wallet shown "redeemed", but no transaction returning the fund.

walletredeem

charlie754 commented 2 years ago

Fun thing is, i've founded one copy of wallet shown "redeemed", but no transaction returning the fund.

walletredeem

walletredeem2

then I reopen this wallet of copy again, it shows Funded again

ecdsa commented 2 years ago

I tested eclair force-close in what I believe are the same conditions reported by this user:

I opened a channel, closed the client before the funding tx was confirmed, and attempted to request a force-close using a wallet backup (without 90dbac5a65a8b7804a5b02a6cf598588a06a71a3, so Electrum sent only ChannelReestablish and no error message).

After that, the channel was visible in eclair channels. I attempted to force-close from CLI, passing --channelId (note: passing --shortChannelId resulted in channel not found).

Eclair responded that it force closed, but without broadcasting its commitment transaction. The log is similar as above:

force-closing channel at user request
deleting database record for channelId=** 
shutting down

I think this needs to be fixed in Eclair, because it may result in fund losses, in case the user has lost its original wallet. @t-bast eclair-node-0.7.0-a804905

ecdsa commented 2 years ago

@charlie754 I managed to reconstruct the commitment transaction and to force-close, using scripts in #7298

see https://blockstream.info/tx/2fb1557447ed04c57407b5160659af9af42c4cd20729bdee811aa7045b6b591d

ecdsa commented 2 years ago

Closing this; the Electrum part of this bug was fixed in 90dbac5a65a8b7804a5b02a6cf598588a06a71a3 The Eclair part has been reported in the Eclair repository.

Coconut-theDog commented 11 months ago

Hi ! i got that bug, update electrum since then. The bitcoin got "redeemed" label ( got this transaction since 05/2023 )

any solution ?