Compacting Channel DB

From PlebNet Wiki
Revision as of 08:41, 26 October 2021 by Itsneski (talk | contribs)
Jump to navigation Jump to search

The Channel DB, or channel.db, stores payments sent by your LND node, including failed payments and failed htlcs from payments. The database is located under ~/umbrel/lnd/data/graph/mainnet/channel.db> on Umbrel.

The file continuously grows in size; it may eventually exceed the available disk space and slow things down. It is recommended to periodically compact the database. See configuration settings to enable compaction of channel.db.

The configuration settings may not be sufficient to reduce channel.db size (the smaller the better). This is especially true if your node rebalances often. You may need to prune config.db manually by calling the LND API DeleteAllPayments. lncli does not currently support the call so you will need to write a script (in say Python or JavaScript) to call the method. Example of a JavaScript code.

Manual pruning may take time to complete depending on the channel.db size. Make sure to wait until it completes and don't interrupt the process. Once pruning completes verify that the number of payments in the channel.db is zero by running lncli listpayments | jq '.payments' | jq length. Delete ~/umbrel/lnd/data/graph/mainnet/channel.db.last-compacted to trigger compaction on restart. Next restart you node.