Difference between revisions of "Compacting Channel DB"

From PlebNet Wiki
Jump to navigation Jump to search
Line 1: Line 1:
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/lnd/data/graph/mainnet/channel.db></code> on Umbrel.
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/lnd/data/graph/mainnet/channel.db></code> 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 [[Special:MyLanguage/LND_Configuration_Settings|enable compaction of channel.db]].
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 [[Special:MyLanguage/LND_Configuration_Settings|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 [https://api.lightning.community/#deleteallpayments DeleteAllPayments].  lncli does not support the call so you will need to write a script (in say Python or JavaScript) to call the method. [https://github.com/itsneski/lightning-jet/blob/main/api/prune-payments.js Example of a JavaScript code].
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 [https://api.lightning.community/#deleteallpayments 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. [https://github.com/itsneski/lightning-jet/blob/main/api/prune-payments.js 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 <code>lncli listpayments | jq '.payments' | jq length</code>.  Delete <code>~/umbrel/lnd/data/graph/mainnet/channel.db.last-compacted</code> to trigger compaction on restart.  Next restart you node.
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 <code>lncli listpayments | jq '.payments' | jq length</code>.  Delete <code>~/umbrel/lnd/data/graph/mainnet/channel.db.last-compacted</code> to trigger compaction on restart.  Next restart you node.

Revision as of 08:38, 26 October 2021

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.