diff --git a/CHANGES.md b/CHANGES.md index fd3a9e7fe..b25d66202 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,7 +3,7 @@ ## What's new in Version 1.7.2 of RaspiBlitz? - Refactor: Cache & Backgroundscan of Systeminfo -- New: Compact the LND channel.db on-demand from REPAIR and before backups [issue](https://github.com/rootzoll/raspiblitz/issues/2752) +- New: Compact the LND channel.db monthly on restart, on-demand from menu and before backups [issue](https://github.com/rootzoll/raspiblitz/issues/2752) - New: Run C-lightning backup-compact regularly [issue](https://github.com/rootzoll/raspiblitz/issues/2869) - New: Switch LNbits between lnd & c-lightning [issue](https://github.com/rootzoll/raspiblitz/issues/2556) - New: Tallycoin Connect [details](https://github.com/djbooth007/tallycoin_connect#readme) diff --git a/home.admin/assets/lnd.bitcoin.conf b/home.admin/assets/lnd.bitcoin.conf index eb9e6eaa9..129b47ef4 100755 --- a/home.admin/assets/lnd.bitcoin.conf +++ b/home.admin/assets/lnd.bitcoin.conf @@ -35,3 +35,7 @@ bitcoin.mainnet=1 autopilot.active=0 autopilot.maxchannels=5 autopilot.allocation=0.6 + +[bolt] +db.bolt.auto-compact=true +db.bolt.auto-compact-min-age=672h diff --git a/home.admin/config.scripts/lnd.check.sh b/home.admin/config.scripts/lnd.check.sh index 4f7682507..ef1b2329a 100755 --- a/home.admin/config.scripts/lnd.check.sh +++ b/home.admin/config.scripts/lnd.check.sh @@ -104,7 +104,7 @@ if [ "$1" == "prestart" ]; then # SET/UPDATE bitcoin.node echo "# ${network}.node insert/update" setting ${lndConfFile} ${insertLine} "${network}\.node" "${network}d" - + ##### BITCOIND OPTIONS SECTION ##### @@ -186,6 +186,28 @@ if [ "$1" == "prestart" ]; then setting ${lndConfFile} ${insertLine} "accept-keysend" "true" fi + ##### BOLT SECTION ##### + # https://github.com/lightningnetwork/lnd/blob/0aa0831619cb320dbb74883c37a80ccbdde7f320/sample-lnd.conf#L1205 + sectionName="bolt" + echo "# [${sectionName}] config ..." + # make sure lnd config has a [bolt] section + sectionExists=$(cat ${lndConfFile} | grep -c "^\[${sectionName}\]") + echo "# sectionExists(${sectionExists})" + if [ "${sectionExists}" == "0" ]; then + echo "# adding section [${sectionName}]" + echo " +[${sectionName}] +" | tee -a ${lndConfFile} + fi + + sectionLine=$(cat ${lndConfFile} | grep -n "^\[bolt\]" | cut -d ":" -f1) + echo "# sectionLine(${sectionLine})" + insertLine=$(expr $sectionLine + 1) + + # make sure API ports are set to standard + setting ${lndConfFile} ${insertLine} "db.bolt.auto-compact-min-age" "672h" + setting ${lndConfFile} ${insertLine} "db.bolt.auto-compact" "true" + ##### TOR SECTION ##### if [ "${runBehindTor}" == "on" ]; then diff --git a/home.admin/config.scripts/lnd.install.sh b/home.admin/config.scripts/lnd.install.sh index 7c7976dc7..9063c7fe1 100644 --- a/home.admin/config.scripts/lnd.install.sh +++ b/home.admin/config.scripts/lnd.install.sh @@ -312,6 +312,10 @@ tlskeypath=/home/bitcoin/.lnd/tls.key bitcoin.active=1 bitcoin.${CHAIN}=1 bitcoin.node=bitcoind + +[bolt] +db.bolt.auto-compact=true +db.bolt.auto-compact-min-age=672h " | sudo -u bitcoin tee /home/bitcoin/.lnd/${netprefix}lnd.conf else echo "# The file /home/bitcoin/.lnd/${netprefix}lnd.conf is already present"