Lightning: How to force remove (forget) a channel

Created on 23 May 2018  路  4Comments  路  Source: ElementsProject/lightning

Most helpful comment

Well, it is already closed, bilaterally, which is why it is in CLOSINGD_COMPLETED state. Doing a close again will not work.

Looking at blockchain explorers, the transaction 629d23e124b20b23adcf988c4cca619e5f2d9bf617a6418c357221cec1495d50 does not exist. So it seems that the channel never got confirmed in the first place. Indeed the lack of a short_channel_id field means the channel never got confirmed. The channel will go to ONCHAIND once we see the channel funding transaction get confirmed, as we will then drop to chain with the bilateral close transaction.

My PR #1468 should make the channel go away after 2 weeks (2016 blocks) if it never confirms and we are the fundee.

Since we are the fundee (msatoshi_to_us is 0) you can safely use dev-forget-channel. Note this is a dev- command and is dangerous and can lose you money. Note no money will get lost in this case because msatoshi_to_us is 0; this may not apply in future issues you encounter and you should not use dev-forget-channel unless you have read the source code around it and understand how it works. Note you need to compile with make DEVELOPER=1 to enable the dev-forget-channel command; by default this command does not exist.

lightning-cli dev-forget-channel id=${id}

All 4 comments

Before you do that, you need to inform us why you need to forget a channel and how much money you have (msatoshi_to_us) in that channel. What is the current state of the channel? What is the result of listpeers?

Do you need to close the channel unilaterally? Then reduce the timeout parameter to 0 on the close command and set force parameter to true. E.g. if you are using lightning-cli:

lightning-cli close id=${idtoclose} force=true timeout=0

This will close the channel unilaterally. Closing will still take some time since the channel needs to be irrevocably resolved according to onchaind.

Forgetting a channel is a different operation and is a much more dangerous one (i.e. can lose your funds!). Are you sure you want to forget the channel or just want to close unilaterally?

~# lightning-cli listpeers|prettyjson 
peers: 
  - 
    id:        02dcdd7e18b80dc7fd51af34e871901c13f574e4b82325dc74c0beeada5771e8e9
    connected: false
    channels: 
      - 
        state:                          CLOSINGD_COMPLETE
        channel_id:                     505d49c1ce2172358c41a617f69b2d5f9e61ca4c8c98cfad230bb224e1239d62
        funding_txid:                   629d23e124b20b23adcf988c4cca619e5f2d9bf617a6418c357221cec1495d50
        msatoshi_to_us:                 0
        msatoshi_to_us_min:             0
        msatoshi_to_us_max:             0
        msatoshi_total:                 20000000
        dust_limit_satoshis:            546
        max_htlc_value_in_flight_msat:  18446744073709552000
        their_channel_reserve_satoshis: 0
        our_channel_reserve_satoshis:   200
        channel_reserve_satoshis:       0
        spendable_msatoshi:             0
        htlc_minimum_msat:              0
        their_to_self_delay:            144
        our_to_self_delay:              144
        to_self_delay:                  144
        max_accepted_htlcs:             483
        status: 
          - Loaded from database
        in_payments_offered:            0
        in_msatoshi_offered:            0
        in_payments_fulfilled:          0
        in_msatoshi_fulfilled:          0
        out_payments_offered:           0
        out_msatoshi_offered:           0
        out_payments_fulfilled:         0
        out_msatoshi_fulfilled:         0

the answer of the command is:

~# lightning-cli close 02dcdd7e18b80dc7fd51af34e871901c13f574e4b82325dc74c0beeada5771e8e9 true 0
{ "code" : -1, "message" : "Peer has no active channel" }
root@light3:~# 

I have several channels like this
this is my node info
{ "id": "02fc95ab87b02980e39a935cc88a5dd8cb4facefbef7f1b9a43b1545605cc017f8", "port": 9735, "address": [ { "type": "ipv4", "address": "104.199.49.213", "port": 9735 } ], "binding": [ { "type": "ipv4", "address": "127.0.0.1", "port": 9735 } ], "version": "v0.5.2-2016-11-21-2773-g8d64145", "blockheight": 524023, "network": "bitcoin" }

Well, it is already closed, bilaterally, which is why it is in CLOSINGD_COMPLETED state. Doing a close again will not work.

Looking at blockchain explorers, the transaction 629d23e124b20b23adcf988c4cca619e5f2d9bf617a6418c357221cec1495d50 does not exist. So it seems that the channel never got confirmed in the first place. Indeed the lack of a short_channel_id field means the channel never got confirmed. The channel will go to ONCHAIND once we see the channel funding transaction get confirmed, as we will then drop to chain with the bilateral close transaction.

My PR #1468 should make the channel go away after 2 weeks (2016 blocks) if it never confirms and we are the fundee.

Since we are the fundee (msatoshi_to_us is 0) you can safely use dev-forget-channel. Note this is a dev- command and is dangerous and can lose you money. Note no money will get lost in this case because msatoshi_to_us is 0; this may not apply in future issues you encounter and you should not use dev-forget-channel unless you have read the source code around it and understand how it works. Note you need to compile with make DEVELOPER=1 to enable the dev-forget-channel command; by default this command does not exist.

lightning-cli dev-forget-channel id=${id}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ldn2017 picture ldn2017  路  4Comments

ZsZolee picture ZsZolee  路  5Comments

gallizoltan picture gallizoltan  路  3Comments

saubyk picture saubyk  路  3Comments

mloop1 picture mloop1  路  4Comments