Compacting Channel DB

From PlebNet Wiki
Revision as of 02:47, 17 October 2021 by Itsneski (talk | contribs) (Created page with "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 <code>~/umbrel/ln...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 and 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 enough to reduce channel.db size sufficiently (the smaller the better). This is especially true if your node rebalances often. You may need to prune config.db manually by using the LND API DeleteAllPayments. lncli does not 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 check that the number of payments in the 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.