Bitcoin Forum
November 02, 2024, 06:59:31 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum funds stuck in lightning. Unable to force close channel  (Read 234 times)
operator55 (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 25


View Profile
August 04, 2021, 06:56:04 PM
Merited by hugeblack (4), Rath_ (2)
 #1

Hi,

I recently tried to use lightning network for the first time. I created new channel then i think i left electrum before channel open transaction confirmed.

After i ran electrum again few hours later, the channel opening transaction was confirmed.
However the channel state is "reestablishing" for long time now




I tried to use force close channel but i get following error:



Any ideas what can be done to release the funds or make the channel working?
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
August 04, 2021, 07:36:07 PM
 #2

Can you see the funding transaction? Are you certain the funds have actually left your wallet - check the transaction history?
Rath_
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
August 04, 2021, 07:39:34 PM
Last edit: August 04, 2021, 08:42:03 PM by Rath_
 #3

After i ran electrum again few hours later, the channel opening transaction was confirmed.

Are you sure about that? Double click on that channel, copy the funding outpoint and look it up in any block explorer. It looks as if the funding transaction has never been broadcast. Also, if Electrum trampoline knew about this channel, there would be a valid channel id.

Edit: Clarification: the short channel ID includes the blockheight at which the transaction was confirmed. So, if the funding transaction has never been broadcast/confirmed, there is no short channel id.
Rath_
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
August 04, 2021, 09:59:17 PM
Merited by hugeblack (4), pooya87 (2), BlackHatCoiner (2), hosseinimr93 (1), DireWolfM14 (1)
 #4

I have just realised something. Your funding outpoint for some reason contains a different (not valid) transaction ID rather than the actual funding transaction. I guess that you could get that channel to work by modifying it manually!

Close Electrum, go to %appdata%\Electrum\wallets and open your wallet file in some text editor. Find the following piece of text:

Code:
"funding_outpoint": {
"output_index": 0,
"txid": "963e417c937bbd97d4e66ad3127f8168f24a4bf38cdaefc427c96922c2e5795d"
},

Replace it with:

Code:
"funding_outpoint": {
"output_index": 0,
"txid": "13822376273207cb13b598f3a9f5b8cc957fae2041c45c0e190c0716948344cb"
},

Save the file and launch Electrum.
DireWolfM14
Copper Member
Legendary
*
Offline Offline

Activity: 2338
Merit: 4541


Join the world-leading crypto sportsbook NOW!


View Profile WWW
August 05, 2021, 02:00:06 AM
 #5

~

Just to add to what Rath_ said, if your wallet is protected by a password you'll have to decrypt it (remove password protection) before you can edit it.

@ Rath_: nice catch, eagle eyes.  How could that have happened?  Was there an automatic RBF when he opened the channel?

  ▄▄███████▄███████▄▄▄
 █████████████
▀▀▀▀▀▀████▄▄
███████████████
       ▀▀███▄
███████████████
          ▀███
 █████████████
             ███
███████████▀▀               ███
███                         ███
███                         ███
 ███                       ███
  ███▄                   ▄███
   ▀███▄▄             ▄▄███▀
     ▀▀████▄▄▄▄▄▄▄▄▄████▀▀
         ▀▀▀███████▀▀▀
░░░████▄▄▄▄
░▄▄░
▄▄███████▄▀█████▄▄
██▄████▌▐█▌█████▄██
████▀▄▄▄▌███░▄▄▄▀████
██████▄▄▄█▄▄▄██████
█░███████░▐█▌░███████░█
▀▀██▀░██░▐█▌░██░▀██▀▀
▄▄▄░█▀░█░██░▐█▌░██░█░▀█░▄▄▄
██▀░░░░▀██░▐█▌░██▀░░░░▀██
▀██
█████▄███▀▀██▀▀███▄███████▀
▀███████████████████████▀
▀▀▀▀███████████▀▀▀▀
█████████████LEADING CRYPTO SPORTSBOOK & CASINO█████████████
MULTI
CURRENCY
1500+
CASINO GAMES
CRYPTO EXCLUSIVE
CLUBHOUSE
FAST & SECURE
PAYMENTS
.
..PLAY NOW!..
nc50lc
Legendary
*
Online Online

Activity: 2590
Merit: 6310


Self-proclaimed Genius


View Profile
August 05, 2021, 08:46:20 AM
 #6

Looks like the channel was already forced-closed by the other party or your recent attempts because the output of: txn 138223... was already spent by txn 258a0b...
The output is P2WSH which likely has "OP_CSV" indicating that it's indeed a result of "force-close" channel.
(Based form the txns, your wallet is P2WPKH)

That's just minutes after your (OP's) last reply and before Rath_'s reply.

Normally, the wallet should automatically create a local transaction with a label: "our_ctx_to_local <short_channel_ID>" to prepare to redeem your funds after the set time in the script.
If you can see a local transaction like that in the history, then it's all good.


Nothing?
You can try Rath_'s suggestion and the wallet might create that said transaction after a few restarts/hours.
(I've experienced something similar in testnet after manually editing a channel or I just imagined it)

If not and about a day has passed, you can create an issue in GitHub (link) and they may be able to return your funds since AFAIK, that output's script should have another public key (for the other party's wallet) that can spend it without waiting for the set time.
Good thing it's "electrum trampoline" which might be owned by one of the devs.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Rath_
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
August 05, 2021, 09:28:58 AM
Last edit: August 05, 2021, 09:42:11 AM by Rath_
 #7

@ Rath_: nice catch, eagle eyes.  How could that have happened?  Was there an automatic RBF when he opened the channel?

No idea. RBF on the opening transaction adds a lot of complexity. That's why it's not available in Electrum. I believe that LND simply performs CPFP if there is a change output. C-lightning uses RBF only if both nodes follow the (experimental) dual-fund/v2 open protocol.

AFAIK, that output's script should have another public key (for the other party's wallet) that can spend it without waiting for the set time.

The RSMC output of the commitment transaction can be spent immediately only using a combination of Electrum trampoline's and OP's revocation keys for that particular transaction. Once the timeout has expired, the output can be also spent using OP's private key. I explained it in detail here.
nc50lc
Legendary
*
Online Online

Activity: 2590
Merit: 6310


Self-proclaimed Genius


View Profile
August 05, 2021, 12:22:11 PM
 #8

-snip-
AFAIK, that output's script should have another public key (for the other party's wallet) that can spend it without waiting for the set time.
The RSMC output of the commitment transaction can be spent immediately only using a combination of Electrum trampoline's and OP's revocation keys for that particular transaction. Once the timeout has expired, the output can be also spent using OP's private key. I explained it in detail here.
I think you're right, I've only checked the script in a commitment transaction, it has a RSMC output with this script (can be seen when spent):
Code:
IF
"public_key1"
ELSE
"timeout" CHECKSEQUENCEVERIFY DROP
"public_key2"
ENDIF
CHECKSIG

Okay so, "public_key1" is the "revocation key" (not electrum trampoline's public key)
which can only be spent by deriving its private key from "electrum trampoline's" "revocation_basepoint_secret" and his "per_commitment_secret".


What I'm concerned with is: his wallet might fail to spend the "to_local" output because of the issue.
In that case, if manually editing the wallet file didn't work, he can still coordinate with the owner of Electrum trampoline to recover his funds.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Geremia
Sr. Member
****
Offline Offline

Activity: 506
Merit: 253


View Profile WWW
December 11, 2021, 10:30:27 PM
 #9




I get these issues in Electrum 0df05dd (master as of today), but in my case the funding transaction doesn't appear in my wallet. What could that mean? How do I fix it?

I opened GitHub issue #7583 8 days ago but haven't received any response yet.

BTC tip jar | my BTC wiki, BTC StackExchange | Tox ID: 65C3E8810738AD9D175234808FCB317A1103632903436203D45411AE97C03F54C34861AB6663
Join Kraken. | The best, free book on Bitcoin: Mastering Bitcoin
Nos cum prole pia benedicat Virgo Maria.
nc50lc
Legendary
*
Online Online

Activity: 2590
Merit: 6310


Self-proclaimed Genius


View Profile
December 12, 2021, 03:27:34 AM
Last edit: December 12, 2021, 04:23:06 AM by nc50lc
 #10

-snip- I get these issues in Electrum 0df05dd (master as of today), but in my case the funding transaction doesn't appear in my wallet. What could that mean? How do I fix it?
The "funding transaction" isn't even available in the blockchain: 963e417c937bbd97d4e66ad3127f8168f24a4bf38cdaefc427c96922c2e5795d
I'm thinking that it may be an invalid channel in the first place, may be created in the wallet but the funding transaction was dropped from the mempools later on.

I got the funding transaction from your screenshot in GitHub.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!