getumbrel / umbrel-lightning

The official Lightning Node app for Umbrel, powered by LND.
https://umbrel.com
Other
17 stars 8 forks source link

[Feature request] Display channel.db size in Dashboard Settings #33

Open Darth-Coin opened 2 years ago

Darth-Coin commented 2 years ago

Description:

Improvement UX/UI to display / alert the user about the size of channel.db file.

Behavior:

The file channel.db that stores all the traffic of LN node, sometimes get really big, depending on node traffic, no. of channels open/closed, HTLCs, no. of payments routed, no. of failed invoices etc. This could have a great impact in node responsiveness and sometimes in force closed channels, no routing, slow apps. Bigger the file it is, more memory is used and swap, in special with Rasp Pi devices.

Solution:

Add a simple widget in "Settings" page of Umbrel Dashboard, that can display the actual size of the channel.db file. Would be also good to have an indicator level in 2-3 colors when the file reached a certain level and needs to be compacted / cleaned up, so the normal user will know how to interpret it visually. Also a simple tick box to be marked, if the user want at the next restart of the node, that the file will be compacted. The box will trigger a script to add into lnd.conf file the following:

[bolt]
db.bolt.auto-compact=true
db.bolt.auto-compact-min-age=168h

[Application Options]
# Mark unpayable, unpaid invoices as deleted
gc-canceled-invoices-on-startup=1
gc-canceled-invoices-on-the-fly=1
# Avoid historical graph data sync
ignore-historical-gossip-filters=1
# Avoid slow startup time
sync-freelist=1
# Avoid high startup overhead
stagger-initial-reconnect=1
# Avoid auto force close channels
payments-expiration-grace-period=30m

Also, when is activated the box, the user receive a pop-up alerting that compacting the file takes time, sometimes hours, so be patient and do not restart forcibly the node. Just check the lnd logs through SSH.

More documentation:

https://www.lightningnode.info/technicals/lnddatabasecompaction https://plebnet.wiki/wiki/Compacting_Channel_DB https://raspibolt.org/bonus/raspberry-pi/system-overview.html https://github.com/lightningnetwork/lnd/issues/5705