-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Lightning open channel: Duplicated output, funds lost #7298
Comments
I can reproduce. The high level flow is this:
So the critical bug is that
Note that the hardware wallet prompts the user twice; one for each foreign output, and also shows the total value of coins leaving the wallet (which is double than expected). |
The "Batch RBF transactions" feature mutates existing "local" and "unconfirmed RBF" transactions when creating new transactions: it simply adds the new outputs to the existing txs (and updates the change). The "RBF" flag is only enforced for unconfirmed txs, not for local txs. The bug was that given a local LN funding tx, when creating a new channel with "batch_rbf" enabled, we would modify the existing local tx, and broadcast that. related: #7298
I don't know. The "Electrum trampoline" node runs eclair.
So the output in question is Could you also share the corresponding channel id? In Electrum, Channels tab, right-click on channel> @ecdsa could you save a copy of the output of |
I known, but i am new to the topic, so I fully trusted Electrum that everything was right. This is my fault. would appreciate if it were possible to use advanced payment dialog (Transaction detail before you sign and broadcast the transction, where you can check outputs and choose minig fee - i am using it for every payment - aka Advanced preview) the Output in question leads to this address https://blockstream.info/address/bc1qack6s4lg760ewntyj8sg8tvdhhnq57mhlpqw4deza9g8400uvswql6jw6y (you are right, it has index 2 of the transaction) Details about the failed channel NodeID: 03ecef675be448b615e6176424070673ef8284e0fd19d8be062a6cb5b130a0a0d1 The output: 2aebbc581ae7d374006ae6abbb7f9a3d7953657661130249a3db780958238eff:0 is change address which is also under my control (bc1qlrv0gx3ddh07ut5835fmkx098kwdqjnhemhkng) (transaction ID actualy doesn't exists)
I have RBF turned off, however, the Batch RBF transactions is enabled (and grayed out). I learned that funding transactions are always RBF, so this option can be in effect. |
You can find the two pubkeys that compose the 2of2 multisig funding output by running these in the
Could you please share what they output? You can also get the private key for one of these pubkeys similarly, your own, the LOCAL one.
|
|
This is easier to understand; the special case is not worth it. related #7298
@ondra-novak If you share a receive address for your coins, we will try to help recover them. Will probably create a PSBT and share that and some instructions. I've spent some time looking at the eclair source code and figured out how we can extract the funding private key. Example below (using regtest). In Electrum Qt, "Console" tab:
On server running eclair:
Python script to calc funding privkey using above data.
prints: |
I have the privkey corresponding to |
Sorry, i did not receive a notification. There si bc1qvd7a7eun3cfet92z65g2qvw009malwlvrljpq9 |
Ok, so for my own future reference, here is a testnet example: cosigner1 runs:
cosigner2 runs:
|
@ondra-novak Here is a PSBT signed by my key (so which has 1 sig for the 2of2 multisig input):
You should load this into a wallet that supports signing PSBTs and sign with your private key (corresponding to the pubkey Check the below snippet I wrote for you, that should be run in a python interpreter. from electrum.bitcoin import script_to_p2wsh
from electrum.transaction import multisig_script, tx_from_any, TxOutpoint, PartialTxInput, PartialTxOutput, PartialTransaction
from electrum import constants, ecc
PUBKEYS = sorted(["03d82db36b7b896077ab0d2b8165a3517a1ee363aa9e9f7bfa2fcfa14ccc81ef03", "0308ecbd369c42f3cd8d06cbedd754dfa2c24c8a4bca78a0e824f9c385d9b8da52"])
FUNDING_TX_HEX = "02000000000102677dcd8d8caa1dd7c5618ee041a3d3d40f34ded40c091337d515237cfa068e390000000000feffffff23fca5a14e99cf11e4f20ee398f11256ec1a91fbf3858939132c3933014891460000000000feffffff03b803760000000000160014f8d8f41a2d6ddfee2e878d13bb19e53d9cd04a77ffffff0000000000220020bacb077d7e184156757035c326c0193de782678b34f2c69aab4412fc797422e2ffffff0000000000220020ee2da857e8f69f974d6491e083ad8dbde60a7b77f840eab722e9507abdfc641c0247304402200351d1af5aad640964f6458aaa81bd7ff80166034ed714860bec5a5daa57d4940220326c9a3b95ace46a82f8186c13982c0708c404ddc71cb057fae475f6b5a3cb78012103faefe606c61750e83e7197dbc58dacbbfc69e6e8d65840c66d3773c23e8f0689024730440220722c6fb4dd2b7e6dbe93de340092f71ab266cc283ecaa709dcc2e379ae17fbf2022062c878642f704610c8ba57d699a1debd6741ea32c714b11e450101647df376dc012103d4383f8e94c41bdea0ef4556bed6c05f14d0c950231440bc7ec2440408beb0f3446e0a00"
FUNDING_OUTIDX = 2
MYPRIVKEY2 = bytes.fromhex("XXXXXTODOXXXXX")
SWEEP_TX = tx_from_any("cHNidP8BAFICAAAAAf+OI1gJeNujSQITYXZlU3k9mn+7q+ZqAHTT5xpYvOsqAgAAAAD9////ATf1/wAAAAAAFgAUY33fZ5OOE5WVQtUQoDHPeXffu+wAAAAAAAEA/akBAgAAAAABAmd9zY2Mqh3XxWGO4EGj09QPNN7UDAkTN9UVI3z6Bo45AAAAAAD+////I/yloU6ZzxHk8g7jmPESVuwakfvzhYk5Eyw5MwFIkUYAAAAAAP7///8DuAN2AAAAAAAWABT42PQaLW3f7i6HjRO7GeU9nNBKd////wAAAAAAIgAgussHfX4YQVZ1cDXDJsAZPeeCZ4s08saaq0QS/Hl0IuL///8AAAAAACIAIO4tqFfo9p+XTWSR4IOtjb3mCnt3+EDqtyLpUHq9/GQcAkcwRAIgA1HRr1qtZAlk9kWKqoG9f/gBZgNO1xSGC+xaXapX1JQCIDJsmjuVrORqgvgYbBOYLAcIxATdxxywV/rkdfa1o8t4ASED+u/mBsYXUOg+cZfbxY2su/xp5ujWWEDGbTdzwj6PBokCRzBEAiByLG+03St+bb6T3jQAkvcasmbMKD7KpwncwuN5rhf78gIgYsh4ZC9wRhDIulfWmaHevWdB6jLHFLEeRQEBZH3zdtwBIQPUOD+OlMQb3qDvRVa+1sBfFNDJUCMUQLx+wkQECL6w80RuCgAiAgMI7L02nELzzY0Gy+3XVN+iwkyKS8p4oOgk+cOF2bjaUkcwRAIgDm2btm2d6o0WxZhWPyLixUD+w95VaMVxeIjVFPVUTCsCIDOG3dLDxqjZaJwosZdw8GROF4p6D/wq4P67BZwJQypAAQAA")
mypubkey2 = ecc.ECPrivkey(MYPRIVKEY2).get_public_key_bytes()
assert mypubkey2.hex() in PUBKEYS
txin = SWEEP_TX.inputs()[0]
txin.script_type = 'p2wsh'
txin.pubkeys = [bytes.fromhex(pk) for pk in PUBKEYS]
txin.num_sig = 2
SWEEP_TX.sign({mypubkey2.hex(): (MYPRIVKEY2, True)})
print(str(SWEEP_TX)) Let me know if you need further help or if it worked. |
Works! Transaction is on the way. Thank you very much! |
Great. Sorry for the trouble and thanks for the report. |
4.1.2
I have very weird open-channel transaction (trampoline mode)
https://blockstream.info/tx/2aebbc581ae7d374006ae6abbb7f9a3d7953657661130249a3db780958238eff
Funds are probably lost
Reproduction steps
Is there any way how to recover the funds from second output?
TY.
The text was updated successfully, but these errors were encountered: