Difference between revisions of "Compacting Channel DB"

From PlebNet Wiki
Jump to navigation Jump to search
Line 5: Line 5:
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/tools/prune-payments Example of a JavaScript code]. There is also hidden bos command <code>bos delete-payments-history</code> which can do the same. You can find the details [https://github.com/niteshbalusu11/BOS-Commands-Document#delete-payments-history here].
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/tools/prune-payments Example of a JavaScript code]. There is also hidden bos command <code>bos delete-payments-history</code> which can do the same. You can find the details [https://github.com/niteshbalusu11/BOS-Commands-Document#delete-payments-history here].


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.
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: <code>restart lnd cd ~/umbrel ; docker-compose restart lnd; docker-compose ps</code>

Revision as of 16:28, 9 November 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. There is also hidden bos command bos delete-payments-history which can do the same. You can find the details here.

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: restart lnd cd ~/umbrel ; docker-compose restart lnd; docker-compose ps