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

Uncooperative closing on cooperative attempt, presumably due to invalid signature #1340

Closed
akumaigorodski opened this issue Jun 7, 2018 · 10 comments
Labels
bug Unintended code behaviour channel closing Related to the closing of channels cooperatively and uncooperatively commitments Commitment transactions containing the state of the channel

Comments

@akumaigorodski
Copy link

Background

When trying to cooperatively close a channel with remote https://1ml.com/node/02ad6fb8d693dc1e4569bcedefadf5f72a931ae027dc0f0c544b34c1c6f3b9a02b node and "Bitcoin Lightning Wallet" as local node it becomes uncooperative if remote node was used to send or receive payments. Opening and then just closing results in a normal cooperative close.

Here is some locally collected data from one such closing attempt in NEGOTIATIONS state:

funding tx: https://www.smartbit.com.au/tx/cd759a2bae99bbca7c53cb39d9df9e6241fd6ad36bb29f9563059c1b7fd56de1

localShutdown.scriptPubKey: 001447b86c14a5f22402a9d723f50bf8066fcaf9f6c8
remoteShutdown.scriptPubKey: 0014e5f8d6f2f0c12161a011dbc28277e48d00deae4d

localParams.fundingPrivKey.publicKey: 03d494cfa5fd1c78178efe23155bb7c3f9617aeb2710b40c762df41a7aae79e7a3
remoteParams.fundingPubkey: 033915c94eb494f49a89c91bfbb130af24c83b5ca9136ed82523d47f9aa7a46842

their ClosingSigned message: ClosingSigned(channelId = e16dd57f1b9c0563959fb26bd36afd41629edfd939cb537ccabb99ae2b9a75cc, feeSatoshis = 905, signature = 304402203665b7094131323f233d5f320c19e999ec00fa501a88d02cd41a664d300a0beb022076cb64688b1f2e0651a7ab384b61a25079fd30bc2e35f68d4aa40f58a20320b701)

our generated unsigned closing tx: ClosingTx(InputInfo(outPoint = OutPoint(e16dd57f1b9c0563959fb26bd36afd41629edfd939cb537ccabb99ae2b9a75cd, 1), txOut = TxOut(Satoshi(1000000), 0020c5c26425478c06f3381bcda10d5d02c9a124b178bb10c487081dff723c45c18a), redeemScript = 5221033915c94eb494f49a89c91bfbb130af24c83b5ca9136ed82523d47f9aa7a468422103d494cfa5fd1c78178efe23155bb7c3f9617aeb2710b40c762df41a7aae79e7a352ae), tx = 0200000001e16dd57f1b9c0563959fb26bd36afd41629edfd939cb537ccabb99ae2b9a75cd0100000000ffffffff015c3c0f000000000016001447b86c14a5f22402a9d723f50bf8066fcaf9f6c800000000)

our ClosingSigned mesage in response: ClosingSigned(channelId = e16dd57f1b9c0563959fb26bd36afd41629edfd939cb537ccabb99ae2b9a75cc, feeSatoshis = 905, signature = 304402202136242ee50c1decf8b761ab104ae1a9230bd596ffed981e6f285d8bae8a1aac022061e2ce4945d7193c5d98f128cba915c3404993913bd322d4c8d2347bacc5fbac01)

resulting signed closing tx: ClosingTx(InputInfo(outPoint = OutPoint(e16dd57f1b9c0563959fb26bd36afd41629edfd939cb537ccabb99ae2b9a75cd, 1), txOut = TxOut(Satoshi(1000000), 0020c5c26425478c06f3381bcda10d5d02c9a124b178bb10c487081dff723c45c18a), redeemScript = 5221033915c94eb494f49a89c91bfbb130af24c83b5ca9136ed82523d47f9aa7a468422103d494cfa5fd1c78178efe23155bb7c3f9617aeb2710b40c762df41a7aae79e7a352ae), tx = 02000000000101e16dd57f1b9c0563959fb26bd36afd41629edfd939cb537ccabb99ae2b9a75cd0100000000ffffffff015c3c0f000000000016001447b86c14a5f22402a9d723f50bf8066fcaf9f6c8040047304402203665b7094131323f233d5f320c19e999ec00fa501a88d02cd41a664d300a0beb022076cb64688b1f2e0651a7ab384b61a25079fd30bc2e35f68d4aa40f58a20320b70147304402202136242ee50c1decf8b761ab104ae1a9230bd596ffed981e6f285d8bae8a1aac022061e2ce4945d7193c5d98f128cba915c3404993913bd322d4c8d2347bacc5fbac01475221033915c94eb494f49a89c91bfbb130af24c83b5ca9136ed82523d47f9aa7a468422103d494cfa5fd1c78178efe23155bb7c3f9617aeb2710b40c762df41a7aae79e7a352ae00000000)

An attempt to verify a transaction yields an error which originates here: https://github.com/btcontract/lnwallet/blob/4a935e0cf440814f3892c927ecd14b6678623638/app/src/main/java/fr/acinq/bitcoin/Script.scala#L662

Your environment

remote LND node is owned by @robtex, hopefully he can provide details

Steps to reproduce

Open a channel with https://1ml.com/node/02ad6fb8d693dc1e4569bcedefadf5f72a931ae027dc0f0c544b34c1c6f3b9a02b, send some payments, try to close cooperatively (no pending HTLCs present).

Expected behaviour

Cooperative closing.

Actual behaviour

Uncooperative closing with locally published commit.

@robtex
Copy link

robtex commented Jun 7, 2018

lnd version "version": "0.4.2-beta commit=991c9fb7dd534a7cbc7ce9505e7eca8fa2a63bc8"

@akumaigorodski
Copy link
Author

related remote LND log: http://paste.ubuntu.com/p/SSxrnpqGfq/

@halseth
Copy link
Contributor

halseth commented Jun 7, 2018

@btcontract the logs looks to only contain the lines with the channel point printed. Possibly to provide a bit more verbose logs, containing all the log lines in the same range?

@robtex
Copy link

robtex commented Jun 7, 2018

@halseth
egrep '^2018-06-07 05:[34]' should cover the range above. see pastebin.
let me know if you need larger range.
the node only has standard loglevel to keep the logs tiny

http://paste.ubuntu.com/p/HY3KFDVchy/

@halseth
Copy link
Contributor

halseth commented Jun 7, 2018

@robtex Log looks just blank to me. Just took a while to load 😅

@robtex
Copy link

robtex commented Jun 7, 2018

yeah sorry about my sense of humour. "keep the logs tiny"
i wish there was a good way to grep the log for everything regarding a special channel. a local sequential id would be fine, since it could then be the same id before and after the channel has been confirmed, and it could be short.

@halseth
Copy link
Contributor

halseth commented Jun 7, 2018

To summarize:
LND proposes a fee of 905, which "Bitcoin Lightning Wallet" accepts. BLW then creates the closing tx using the signature sent by LND, but the transaction fails to verify, so BLW force closes the channel instead.

@halseth halseth added bug Unintended code behaviour channel closing Related to the closing of channels cooperatively and uncooperatively commitments Commitment transactions containing the state of the channel labels Jun 7, 2018
@Roasbeef
Copy link
Member

Roasbeef commented Jun 8, 2018

Outpoint doesn't show up in those logs at all. Are you able to reproduce in a more isolated environment? Also is BLW caught up with the latest eclair? We haven't seen any issues reported from the latest version of their app like this lately.

@halseth
Copy link
Contributor

halseth commented Jun 8, 2018

I think it is this outpoint:

2018-06-07 05:42:58.139 [INF] PEER: ChannelPoint(cd759a2bae99bbca7c53cb39d9df9e6241fd6ad36bb29f9563059c1b7fd56de1:1): sending shutdown message
2018-06-07 05:42:58.139 [INF] PEER: ChannelPoint(cd759a2bae99bbca7c53cb39d9df9e6241fd6ad36bb29f9563059c1b7fd56de1:1): Responding to shutdown
2018-06-07 05:42:58.466 [INF] PEER: ChannelPoint(cd759a2bae99bbca7c53cb39d9df9e6241fd6ad36bb29f9563059c1b7fd56de1:1): computing fee compromise, ideal=905, last_sent=0, remote_offer=477
2018-06-07 05:42:58.467 [INF] PEER: ChannelPoint(cd759a2bae99bbca7c53cb39d9df9e6241fd6ad36bb29f9563059c1b7fd56de1:1): proposing fee of 905 sat to close chan

@Roasbeef
Copy link
Member

Fixed by #1349.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended code behaviour channel closing Related to the closing of channels cooperatively and uncooperatively commitments Commitment transactions containing the state of the channel
Projects
None yet
Development

No branches or pull requests

4 participants