lightninglabs / lightning-app

An easy-to-use cross-platform Lightning wallet
GNU General Public License v3.0
899 stars 173 forks source link

Stuck on "Waiting Close" #1340

Open Ownsin opened 3 years ago

Ownsin commented 3 years ago

Hello, I'm new to lightning, and when I got some BTC in my Lightning Wallet. It created a channel for me automatically because Autopilot was on. I disabled autopilot and closed the channel, however It has been stuck on "Waiting Close" for two hours now. How can I fix this?

Thank you.

halseth commented 3 years ago

Just wait for a chain conformation, then it will be properly closed.

pinheadmz commented 3 years ago

Same issue. Close TX actually has been confirmed for over 24 hours

halseth commented 3 years ago

Same issue. Close TX actually has been confirmed for over 24 hours

Is it still "Watiing close" or "pending close"? If it is "pending close" you must wait for the channel CSV delay to expire.

pinheadmz commented 3 years ago

On my app it says "waiting close", and in the transactions screen it still indicates "unconfirmed". The channel-closing commitment TX now is up to 828 confirmations. This was actually a channel to another LND node I run, I don't mind sharing the details below.

The output on the not-ios-app side has already been swept with a single signature so I guess the other output to the iOS app is the CSV output. I can email logs from the iOS app if that will help. It otherwise indicates that it is in sync

{
    "channel_id": "654217115265400833",
    "chan_point": "5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1",
    "last_update": 1597514735,
    "node1_pub": "026cfd335ebb9d80b4e0390cd067c98e0996ce1ed0beed684b694080c70f5d61c7",
    "node2_pub": "0355157b4260b70c7f407a720c527a84e9522cd948e7a8ad92ae00773be52488e3",
    "capacity": "200000",
    "node1_policy": {
        "time_lock_delta": 40,
        "min_htlc": "1",
        "fee_base_msat": "1000",
        "fee_rate_milli_msat": "1",
        "disabled": true,
        "max_htlc_msat": "198000000",
        "last_update": 1597514735
    },
    "node2_policy": {
        "time_lock_delta": 0,
        "min_htlc": "0",
        "fee_base_msat": "0",
        "fee_rate_milli_msat": "0",
        "disabled": false,
        "max_htlc_msat": "0",
        "last_update": 1597510232
    }
}
halseth commented 3 years ago

Looking at the unswept value (0.00004029 BTC) I suspect it is determined too low to be swept after chain fees.

pinheadmz commented 3 years ago

I think that small balance is on the other side of the channel though.

IMG_0731

pinheadmz commented 3 years ago

Sorry actually I think we got TXs mixed up.

channel point is 5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1

so that 4029 satoshis output is the CHANGE from opening the channel. Which kinda sucks, the app probably should not have bothered with that output when creating the channel but might've been a UI thing like opening a channel for "20 USD" or something.

channel close: bbb356b10f3a11ccf022048703bf96b1b9949ee547be37df833f64a5ebd5ade8

output 0 there is my remote lnd-connected-to-full-node that I run at home, I can verify that the remote node swept that output in tx 57a4585...:

 $ lncli --no-macaroons listchaintxns | jq '.transactions[] | select(.tx_hash=="57a4585c92852d23b006f1712d276ec81355728396f2145fd4cc15ebc4439dfa")'
{
  "tx_hash": "57a4585c92852d23b006f1712d276ec81355728396f2145fd4cc15ebc4439dfa",
  "amount": "6754",
  "num_confirmations": 2256,
  "block_hash": "000000000000000000009e708bbc863118946287cc4753a43c3826ae08e12962",
  "block_height": 643886,
  "time_stamp": "1597518877",
  "total_fees": "0",
  "dest_addresses": [
    "bc1qvjre0zvdrymzc2hwvra73dt44c4udzly4mxr2t"
  ],
  "raw_tx_hex": "02000000000101e8add5eba5643f83df37be47e59e94b9b196bf03870422f0cc113a0fb156b3bb00000000000000000001621a000000000000160014648797898d19362c2aee60fbe8b575ae2bc68be4024830450221008a332337aae3a4e8d0eb75a9db8ab7e142e692fb12ca34e4ca7a904d5c9a382902201a37d7ef7481420a245ad417ccb533b14198d5795769728d6ee1a71063c85b05012102028576fecfca767dbd7d455b2a6f8e32d0197f0c6432da0431229821809af1fc2cd30900"
}

So, transaction bbb356b10f3a11ccf022048703bf96b1b9949ee547be37df833f64a5ebd5ade8 output index 1, with value of 0.00185968 BTC should be paying back to iOS app.

Are there any advanced functions like chain rescan available in the app?

At this point I think I may just install the desktop version of the app and recover from seed just to sweep the on-chain funds.

halseth commented 3 years ago

Gotcha, yeah looks like it is still unconfirmed there. Can you check the logs, see if it is doing anything at all?

pinheadmz commented 3 years ago

Grepping for the close tx:

2020-08-15 18:05:36.562 [INF] LNWL: Inserting unconfirmed transaction bbb356b10f3a11ccf022048703bf96b1b9949ee547be37df833f64a5ebd5ade8
2020-08-15 18:05:37.328 [INF] PEER: channel(595007:2400:1) force closed with txid bbb356b10f3a11ccf022048703bf96b1b9949ee547be37df833f64a5ebd5ade8
2020-08-15 18:08:36.301 [INF] CNCT: Re-publishing closing tx(bbb356b10f3a11ccf022048703bf96b1b9949ee547be37df833f64a5ebd5ade8) for channel 5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1

anything else I should search for?

pinheadmz commented 3 years ago

Update: I tried installing lightning-app for desktop and restoring the wallet from seed phrase, hoping that the desktop wallet would be able to recover the sweep-from-channel-close transaction. Unfortunately that did not work. You can see in the screen shots below that the desktop app was able to import the same set of transactions as the iOS app, but still unable to recover that last TX. This makes me wonder about the rescan process in LND/lightning-app or if something could be faulty in the compact block filter processing? Or is the address the sweep TX pays to beyond the gap limit for the BIP44 portion of the wallet? Like, how is that key generated in LND?

It's getting to the limit of what I will try to do to recover $20 but can I try importing the seed phrase into another wallet like electrum or bcoin and rescan with a bigger gap limit?

Desktop TX list after restoring from seed:

Screen Shot 2020-09-14 at 1 10 47 PM

TX list from iOS app:

IMG_0843 IMG_0844

IMG_0845

halseth commented 3 years ago

@pinheadmz Are those logs you grepped from the iOS app? What I'm looking for is whether it is able to detect that channel 5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1 is closed on-chain. If you can get the full logs from the iOS app after startup and upload them that would be helpful.

Unfortunately the seed only works with lnd, and since it hasn't been swept it won't yet be found in the regular lnd wallet.

pinheadmz commented 3 years ago

@halseth I sent you the complete log on slack, here's a snippet of the log grepped for the channel open tx:

2020-08-15 18:08:36.301 [INF] CNCT: Re-publishing closing tx(bbb356b10f3a11ccf022048703bf96b1b9949ee547be37df833f64a5ebd5ade8) for channel 5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1
2020-08-15 18:08:37.173 [INF] NTFN: New spend subscription: spend_id=1, outpoint=5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1, height_hint=628915
2020-08-15 18:08:37.175 [INF] CNCT: Close observer for ChannelPoint(5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1) active
2020-08-15 18:08:37.177 [INF] CNCT: ChannelArbitrator(5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1): starting state=StateCommitmentBroadcasted
2020-08-15 18:08:37.182 [INF] CNCT: ChannelArbitrator(5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1): noop trigger chainTrigger
2020-08-15 18:08:37.947 [INF] PEER: NodeKey(0355157b4260b70c7f407a720c527a84e9522cd948e7a8ad92ae00773be52488e3) loading ChannelPoint(5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1)
2020-08-15 18:08:37.947 [WRN] PEER: ChannelPoint(5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1) has status ChanStatusDefault|ChanStatusBorked|ChanStatusCommitBroadcasted, won't start.
halseth commented 3 years ago

2020-08-15 18:08:37.173 [INF] NTFN: New spend subscription: spend_id=1, outpoint=5c2fba8298178953a5a39fb4c50bf735404b4197af8b050f6c6fcba95150a46c:1, height_hint=628915

So it is scanning from a block pretty far back, so it might be that it just takes a long time. How long did you leave the app open?

pinheadmz commented 3 years ago

Ok! I got my $20 back, thanks to @halseth -- basically the thing for me to do was just leave the iOS open and running in the foreground for several hours. The app eventually detected the channel close after syncing the blockchain. It's a little hard to tell what's going on because the app will indicate that it is "synced" and the internal log don't print messages about scanning blocks (otherwise I think I'd notice it was processing a low height).

Anyway - thank you! Just saved my sats.