Lnd: lncli - make it possible to close channel based on channel_point or chan_id

Created on 3 Jan 2018  Â·  22Comments  Â·  Source: lightningnetwork/lnd

Why lnc needs founding_id?

lncli closechannel [command options] funding_txid [output_index [time_limit]]

When call lncli listchannels, there is no funding_txid shown for channels. So user don't know how to close existing channel if didn't save funding_txid during channel opening.

Why cant closechannel use channel_point or _chan_id as parameter?

The message suggest, that there should be "chan_id", so maybe just help is invalid?

[lncli] rpc error: code = Unknown desc = channel with chan_id=11e23246f03d6e14f491b8a7210c27be7e1f4f50b90bfdb0d44575994cb05121 not found

But when I pased channel ID shown by listchannels I got such error:

lncli closechannel ‭1382286227238092801
[lncli] encoding/hex: invalid byte: U+00E2 'â'

The same with convert this to hex:

lncli closechannel ‭‭‭132EDE0000710001‬
[lncli] encoding/hex: invalid byte: U+00E2 'â'

Most helpful comment

It took an hour (!) to find out that it is the channel point divided by a colon AND the Output index are are mention in the output, but as an argument a simple
lncli closechannel 03e8e8dee4fef0a1cce57bca41a11e84aca472d8f9e525a011ac36fe91fcbfd2 1
did the job! See the blank!

All 22 comments

It _already_ is possible to close a channel using the channel point. On the command line, it accepts the channel point's two values separately. A channel point is fundingtxid:output_index.

I also cannot close channels :

> lncli listchannels
{
    [
        { (multiple channels info not pasted here) }
        {
            "active": false,
            "remote_pubkey": "03e65880607578a108440df09580878f12e0800e88c09e313d91da02847da0cebe",
            "channel_point": "9da5b21b49668a97fa353fa15a9c24a0cc6cbe043f058cc44d7c3bda8360a61c:1",
            "chan_id": "0",
            "capacity": "16777216",
            "local_balance": "0",
            "remote_balance": "16756944",
            "commit_fee": "20272",
            "commit_weight": "552",
            "fee_per_kw": "28000",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [
            ],
            "csv_delay": 4
        }
    ]
}

And then :

> lncli closechannel 9da5b21b49668a97fa353fa15a9c24a0cc6cbe043f058cc44d7c3bda8360a61c 1
[lncli] rpc error: code = Unknown desc = channel with chan_id=1ca66083da3b7c4dc48c053f04be6ccca0249c5aa13f35fa978a66491bb2a59c not found

@camalolo Hi, since the channel is not active, you have to make a force close :)

@Richard87 I see ! Thanks for the clarification !

It took an hour (!) to find out that it is the channel point divided by a colon AND the Output index are are mention in the output, but as an argument a simple
lncli closechannel 03e8e8dee4fef0a1cce57bca41a11e84aca472d8f9e525a011ac36fe91fcbfd2 1
did the job! See the blank!

Hi @jagottsicher , what do you mean by "See the blank!"? I also wanted to close an active channel, but when I've done the corresponding analogue command (same format as you did above), I see a blinking cursor since hours, and it seems to be crashed in the window I issued the command! Is this what you mean? Or, any tipp?

you need to see the output of
lncli listchannels

here is an output shown like
9da5b21b49668a97fa353fa15a9c24a0cc6cbe043f058cc44d7c3bda8360a61c:1

see the second last digit is a colon. exchange that to a space.
you get
9da5b21b49668a97fa353fa15a9c24a0cc6cbe043f058cc44d7c3bda8360a61c 1

that is the blank I mentioned.

so the command is:
lncli closechannel 9da5b21b49668a97fa353fa15a9c24a0cc6cbe043f058cc44d7c3bda8360a61c 1

if your cursor is blinkiing for hours without any reaction something else went wrong.

Both, the channels I had already before, are now "active": false (one of them were at least "active": true), but now, while I try to close them, I get the rpc error (twice):

[lncli] rpc error: code = Unknown desc = unable to gracefully close channel while peer is offline (try force closing it instead): channel link not found

I would like to close at least one them to move the fund to my smartphone wallet

Now, I found the correct command syntax: lncli closechannel --force ...

I had a channel opening for 4 days, when checking for the channel_point on a blockchain explorer - it didnt find it.
I force closed it and now its hanging on closing. (closing what though?)

When looking at a block explorer, did you remove the colon and the number after it from the channel point? The format of channel point is <fundingtxid>:<txoutindex>. But the block explorer will only find it if you search for the fundingtxid.

When looking at a block explorer, did you remove the colon and the number after it from the channel point? The format of channel point is <fundingtxid>:<txoutindex>. But the block explorer will only find it if you search for the fundingtxid.

Yap.
Tried automatically using the ZAP desktop wallet (where you click the link)
and manually from the lncli

Would you mind posting the channel point here so I can take a look? Or PM me on Slack if you don't want to post it here.

Hi, its fine (since it has no info anyway:)-
0cf23c14696cf862ae9b9dd48fb2b28c9c05dccdde87672406e8bef19f9e2a56

it was pending for a while, so i used lncli to force close it - now those specific funds are missing to im waiting it out.

Thanks. I checked it on several other block explorers. If the fee was too low (smaller than 1 sat/byte), it could have happened that not all explorers showed it because it was below the relay limit.
But it definitely is nowhere to be found.
What does lncli listchaintxns say? Is the transaction listed there? If yes, what does the previous output say if you look at it in a block explorer? If it is indeed still unspent then the channel never happened.
Are you using neutrino? Bitcoind? Btcd?

lncli listchaintxs returns a LOT of data (i already have 2 channels open besides this problematic type)
BUT I can see what we are looking for there as the last one:

` "tx_hash": "0cf23c14696cf862ae9b9dd48fb2b28c9c05dccdde87672406e8bef19f9e2a56",

        "amount": "-413959",
        "num_confirmations": 0,
        "block_hash": "",
        "block_height": 0,
        "time_stamp": "1572345558",
        "total_fees": "13959",
        "dest_addresses": [
            "bc1qyhkzhcymfymznr2s9kayrzs28nvcqqgvv2ema",
            "bc1qplq5hjum6dwld90wjq5t25aa35ql6pc4sw80e293u0emefr66hsgal353"
        ],
        "raw_tx_hex": "010000000001086f4ac0cef3cc5737bc41171e2c2162b5015132317eeafa01ca2add322e1a61090000000000fffffffff46a78d517324d45633bdf1bd5a94008147012018358ee2736418b70a62f1f360000000000ffffffff1328a56ac999dba73b55e3a8e0133cc641104863aa518304f4ed59c9de7200370000000000ffffffff8d75a3304245c4ab9e00b5d2e93f1a98eaa3592d3807ea5b15d4df602e48bc7a0000000000ffffffff35c712d8686cc6061ee128a0ef0e510b68f3de1afda11496ad06262ad99b0bad0000000000ffffffffe7f76933c82cbcc76b6a9c137ca12b9e1e2055550bdeaf6768ded727c6938da0000000000ffffffff5feb61df327c6c00617f27e8813ea08bd7e297e0e79e0dad01f4efc95cd0b0fb0100000000ffffffffdcc19591b78ea8db69dbfc129b2e4e65d86b46fb78708c3366bbfb325d850bfe0000000000ffffffff02f34900000000000016001425ec2be09b4936914c6a816dd20c5051e6cc0008801a060000000002200200fc14bcb9bd35df695ee1c8145aa9dec680fe838ac1c77e5458f1f9de523d6af02483045022100e11cb3b04d292273c4164cd377f74f6763bb21f7682a683ca2d65a8dcb20ccac022037e6f5f095910cb15913891fa8289559886f7eab16a3efe18e11c7066ed05090012102b7ebaf5b646da56193ddc4085e1ee7145dc056fc4c2ae28b65150ac5d608131602483045022100840e657d5265139e090246e530bb91b8c365525e1a063656eff6fccd39e97d9102202a32132c6abdc61df2c0e87624305bbd6b0f43c46c102d85bed89a31b76f38a0012102f4727bd779e28292d960a2794feb324cf59337fc10047a343e48db636e21d4e902483045022100869587307c86b23c4db95c44a7e6915f22070fbb507c6f5df25e8a54363105cd02207d92d1b7eb90ca26f3ac405c6afd7809a68d6b421f21b1054330ab8cc477437e0121029e77982e0f3bbcf0435645445462e359c9def4b8f49c85048b6230cd80a93f6b0247304402205090a68c72e89430fbdfdff978ec0f95c156ddd857d9f25e9bdb4bdcc0d5aee402207d6eacbcbb069b9c5e24c2c77d14a5b9d8083c9d1fa464dc7c5534826ab7d6c501210203ad501c6d41728f7e1d0da2649be2bd5dfccd205f36c1d61e8d5e390968bcbf02483045022100b92c79639c4ef951d6008dabaae4c6788723b3d00f223905c13755daa4a9f1240220280068bc500d6e95a0fec7d5e40ab6ca522d35b2fab76681b2f7d812d0dca765012102d4309fe582e62801d8cfa3226eba11a6d1f20905210d821a1724afb32dab5d4302473044022004b18b5cb9f313b689db5a10e9b5ccf1daf501c699423c9c6844f515ecf3573402205b0056069bb09db032f7badd89bf5f48db70630a39294b5f16d2bef2ff5d6465012102f7a9bd8d63ffa8a2ffabf9c7f334752d69c115719888d7fc4d73bd2872c53ef3024730440220414c2202336068e989d22809d4e85e4410d7f0abe96d212d07674b94c61eab6b02202619aaa00c77fa2199a66f0f49d115faa64e676597d10d9e3c08bfbecde359a10121023a8664daf2b768e86620abade6560b3792fe0eeed6dc4daca6534b24e499fb6802483045022100a4158ccb19120c10a486158364e25c8dd390e010683c68d9eba7853f58b62a920220744fbd085d804ed310b8c7e97c0d19068975b40d27639607031c9b70b48832fd0121022c1322d51689b2a07ba96e7958773d9ac312e8ab918e21e124e6a03c4496a8dd00000000"
    }

`

I am using bitcoind with lnd

It looks like the transactions is valid and the outputs weren't spent before.
Probably it just got lost. I pushed the TX again and it now got confirmed. Now let's see if lnd can do the force-close.

Thank you for your help.
anything i need to on my side?

No problem!
Yeah, you might want to have a look at what lnd does with the channel now. Maybe you need to force-close again. Or maybe it will now show as normal/operational and can be used.

right now when checking pendingchannels i get:

`

"total_limbo_balance": "395785",

"pending_open_channels": [
],
"pending_closing_channels": [
],
"pending_force_closing_channels": [
],
"waiting_close_channels": [
    {
        "channel": {
            "remote_node_pub": "03634bda49c9c42afd876d8288802942c49e58fbec3844ff54b46143bfcb6cdfaf",
            "channel_point": "0cf23c14696cf862ae9b9dd48fb2b28c9c05dccdde87672406e8bef19f9e2a56:1",
            "capacity": "400000",
            "local_balance": "395785",
            "remote_balance": "0",
            "local_chan_reserve_sat": "4000",
            "remote_chan_reserve_sat": "4000"
        },
        "limbo_balance": "395785"

`

Is it safe for my funds (the ones in limbo) to run the force close command again?
Or should I wait?

There is no transaction that spends from the funding TX yet. You can try restarting lnd first and see if anything changes. If that doesn't help, you can try force-closing again.

well, its still under pending, when trying to force-close it (After restarting) - it says the channel is already in the process of being force closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anaoum picture anaoum  Â·  4Comments

hxsquid picture hxsquid  Â·  3Comments

alexbosworth picture alexbosworth  Â·  3Comments

joostjager picture joostjager  Â·  3Comments

sunnya97 picture sunnya97  Â·  3Comments