Adjust lnd.conf for healthcheck parameters (#4052)

* Adjust lnd.conf for healthcheck parameters, allowing for longer timeout intervalls for rpc connection (#4010)
* adding healthcheck values

---------

Co-authored-by: HODLmeTight <35168804+TrezorHannes@users.noreply.github.com>
This commit is contained in:
/rootzoll 2023-08-01 00:46:35 +02:00 committed by GitHub
parent 91ba149d98
commit 1355a2b4a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 22 deletions

View file

@ -37,3 +37,9 @@ autopilot.allocation=0.6
[bolt]
db.bolt.auto-compact=true
db.bolt.auto-compact-min-age=672h
# Allow for longer latency, especially useful for <8GB RAM Pi and congested mempool
[healthcheck]
healthcheck.chainbackend.attempts=3
healthcheck.chainbackend.timeout=2m0s
healthcheck.chainbackend.interval=1m30s

View file

@ -311,8 +311,6 @@ if [ "$1" == "prestart" ]; then
fi
##### RPCMIDDLEWARE SECTION #####
# [rpcmiddleware]
sectionName="rpcmiddleware"
echo "# [${sectionName}] config ..."
@ -346,6 +344,38 @@ if [ "$1" == "prestart" ]; then
# SET/UPDATE rpcmiddleware.enable
setting ${lndConfFile} ${insertLine} "rpcmiddleware.enable" "true"
##### HEALTHCHECK SECTION #####
sectionName="healthcheck"
echo "# [${sectionName}] config ..."
# make sure lnd config has a [healthcheck] section
sectionExists=$(cat ${lndConfFile} | grep -c "^\[${sectionName}\]")
echo "# sectionExists(${sectionExists})"
if [ "${sectionExists}" == "0" ]; then
echo "# adding section [${sectionName}]"
echo "
[${sectionName}]
" | tee -a ${lndConfFile}
fi
# get line number of [healthcheck] section
sectionLine=$(cat ${lndConfFile} | grep -n "^\[${sectionName}\]" | cut -d ":" -f1)
echo "# sectionLine(${sectionLine})"
insertLine=$(expr $sectionLine + 1)
echo "# insertLine(${insertLine})"
fileLines=$(wc -l ${lndConfFile} | cut -d " " -f1)
echo "# fileLines(${fileLines})"
if [ ${fileLines} -lt ${insertLine} ]; then
echo "# adding new line for inserts"
echo "
" | tee -a ${lndConfFile}
fi
# SET/UPDATE healthcheck values
setting ${lndConfFile} ${insertLine} "healthcheck.chainbackend.attempts" "3"
setting ${lndConfFile} ${insertLine} "healthcheck.chainbackend.timeout" "2m0s"
setting ${lndConfFile} ${insertLine} "healthcheck.chainbackend.interval" "1m30s"
echo "# OK PRESTART DONE"
######################################################################
@ -419,26 +449,6 @@ elif [ "$1" == "basic-setup" ]; then
echo "err='$(netprefix)lnd.conf: blockchain network in $(netprefix)lnd.conf (${lndNetwork}) is different from raspiblitz.conf (${network})'"
fi
# # get chain from config (TESTNET / MAINNET)
# lndChain=""
# source <(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep "${lndNetwork}.mainnet" | sed 's/^[a-z]*\.//g')
# source <(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep "${lndNetwork}.testnet" | sed 's/^[a-z]*\.//g')
# if [ "${mainnet}" == "1" ] && [ "${testnet}" == "1" ]; then
# echo "err='lnd.conf: mainnet and testnet are set active at the same time'"
# elif [ "${mainnet}" == "1" ]; then
# lndChain="main"
# elif [ "${testnet}" == "1" ]; then
# lndChain="test"
# else
# echo "err='lnd.conf: neither testnet or mainnet is set active (raspiblitz needs one of them active in lnd.conf)'"
# fi
# echo "chain='${lndChain}'"
#
# # check if chain is same the raspiblitz config
# if [ "${chain}" != "${lndChain}" ]; then
# echo "err='lnd.conf: testnet/mainnet in lnd.conf (${lndChain}) is different from raspiblitz.conf (${chain})'"
# fi
# check for admin macaroon exist (on HDD)
adminMacaroonExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c 'admin.macaroon')
if [ ${adminMacaroonExists} -gt 0 ]; then