Get rid of those Zombie Channels!

What are zombie channels?

Zombie channel is a fuzzy notion for channels that are kind of dead, but still roaming around. To be precise: Channels cannot really be dead, only nodes can. Hence from your point of view, a zombie channel is a channel for which your remote node disappeared for such a long time, that you would consider it not to come back online anymore; a node that you would consider to be dead.

A zombie channel cut open

Why bother?

If a channel does not serve any purpose anymore, there is no upside in keeping it. However, there are several downsides:

  • Your money is not liquid as it’s allocated to the unusable channel. Reallocating the funds takes time.
  • You could use this money for another channel that actually works!
  • This channel is a burden on the network. As long as your channel stays open, all peers of the network need to maintain information about that channel. Closing it will remove the channel from the collective memory and let it rest in peace. This is only true for public channels.
  • If your own node goes belly up, you lose all the money you kept in zombie channels!
Bolters reacting to your question about techniques to get your money back

How to identify zombie channels

The problem with zombie channels is that they cannot clearly be identified, since one never knows whether a remote node is shutdown forever or only temporary. Focusing on the following metrics will help you to at least make adequate assumptions:

  • Node is active or inactive: Whenever one of your remote nodes is being turned off, it informs your node that it’s becoming inactive. At startup, it informs your node that it’s active again. Don’t overestimate the significance of this metric for your zombie classification, as you cannot determine if a node is inactive for just 2 minutes or if it has been inactive for several months already.
  • Last channel update: The last time this channel has been updated by your remote node. According to BOLT #7, you may consider a channel to be neglected if the last channel update was received more than two weeks ago.
  • Public or private channels: This metric does not directly help you to identify zombie channels, but it helps you to weight the other metrics. If a channel is private, it was probably never intended to be online all the time, so keep that in mind when looking at metrics like the time of the last channel update, because you might want to be more tolerant with these channels.
  • Local balance: This metric does not help you to identify zombie channels neither, but it shows you the severity of a potential loss, when your own node bites the dust.
  • Disabled: Both nodes that maintain a channel together may tag a channel as disabled, independent of each-other. A node would do so, because it wants to declare a channel as temporarily unavailable or also permanently unavailable. Reasons for this may be a loss of connectivity or a preparation to an on-chain settlement. Note that your remote node’s disabled flag does not necessarily get broadcasted to you, but may just be communicated to peers that are trying to use that channel (spam protection). So your node might not be up-to-date and hence this metric could be misleading.
  • Channel age: When has your channel been created? Might be helpful metadata in one way or another.
  • Channel initiator: Just remember, the node that initiated the channel is also the node that has to pay the on-chain fees for the channel closing.
Don’t panic! Don’t just kill every channel that feels like a Zombie. Use the metrics!

Bash script for zombie channel identification

I’ve written a simple Bash script that should help you to get a quick overview of your potential zombie channels. Adapt the first variable TIME_GAP to define what channels you want to retrieve data for; The elapsed time since last received channel update is used as a treshold.

$ wget -O zombieChannels.sh https://gist.githubusercontent.com/gcomte/013212cc5c2e3662f63ffce5c81829b0/raw/a0c4524248daa10984390b0e7c183eb9e8a6eb95/gistfile1.txt$ sudo chmod +x zombieChannels.sh
$ ./zombieChannels.sh

Using lndmanage

If you want to use a more sophisticated tool for your managing your channels, you may want to consider installing lndmanage. This python tool will deliver all kinds of information about your channels to you, so you can bring your channel hygiene to perfection!

$ lndmanage listchannels inactive

Improvements coming with LND 0.9.0

Software engineer Carla Kirk-Cohen who recently joined Lightning Labs, submitted a pull request this summer, that should make zombie channel identification much easier.

Happy Routing!

Now that your node is fresh and clean, use those freed sats to BUIDL some new channels and hopefully route some more payments! ⚡⚡

 by the author.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store