migrate keysend to raspibltz.conf & lnd.check.sh

This commit is contained in:
rootzoll 2021-08-27 22:38:33 +02:00
parent c1e977d195
commit 29c8128460
4 changed files with 29 additions and 14 deletions

View File

@ -167,6 +167,13 @@ if [ "${lightning}" == "lnd" ]; then
sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service >> ${logFile} 2>&1
# convert old keysend by lndExtraParameter to raspiblitz.conf setting (will be enforced by lnd.check.sh prestart) since 1.7.1
if [ "${lndExtraParameter}" == "--accept-keysend" ]; then
echo "# MIGRATION KEYSEND from lndExtraParameter --> raspiblitz.conf" >> ${logFile}
echo "lndKeysend=on" >> /mnt/hdd/raspiblitz.conf
sudo sed -i "/^lndExtraParameter=/d" /mnt/hdd/raspiblitz.conf 2>/dev/null
fi
# if old lnd.conf exists ...
configExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then

View File

@ -74,7 +74,6 @@ bitcoin.${CHAIN}=1
listen=0.0.0.0:${portprefix}9735
rpclisten=0.0.0.0:1${rpcportmod}009
restlisten=0.0.0.0:${portprefix}8080
accept-keysend=true
nat=false
debuglevel=debug
gc-canceled-invoices-on-startup=true
@ -91,13 +90,6 @@ tlskeypath=/home/bitcoin/.lnd/tls.key
bitcoin.active=1
bitcoin.node=bitcoind
[Watchtower]
watchtower.active=1
watchtower.listen=0.0.0.0:${portprefix}9111
[Wtclient]
wtclient.active=1
[Tor]
tor.active=true
tor.streamisolation=true

View File

@ -128,9 +128,20 @@ if [ "$1" == "prestart" ]; then
# SET/UPDATE rpchost
setting ${lndConfFile} ${insertLine} "${network}d\.rpchost" "127\.0\.0\.1\:${portprefix}8332"
# Application Options
sectionLine=$(cat ${lndConfFile} | grep -n "^\[Application Options\]" | cut -d ":" -f1)
echo "# sectionLine(${sectionLine})"
insertLine=$(expr $sectionLine + 1)
# make sure API ports are set to standard
sed -i "s/^rpclisten=.*/rpclisten=0\.0\.0\.0\:1${rpcportmod}009/g" ${lndConfFile}
sed -i "s/^restlisten=.*/restlisten=0\.0\.0\.0\:${portprefix}8080/g" ${lndConfFile}
setting ${lndConfFile} ${insertLine} "rpclisten" "0\.0\.0\.0\:1${rpcportmod}009"
setting ${lndConfFile} ${insertLine} "restlisten" "0\.0\.0\.0\:${portprefix}8080"
# enforce keysend if 'lndKeysend=on' in raspiblitz.conf
if [ "${lndKeysend}" == "on" ]; then
setting ${lndConfFile} ${insertLine} "accept-keysend" "true"
fi
echo "# OK PRESTART DONE"

View File

@ -19,23 +19,28 @@ if [ "${parameter}" == "on" ]; then
# store to raspiblitz config (delete old line / add new)
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
echo "lndExtraParameter='--accept-keysend'" >> /mnt/hdd/raspiblitz.conf
echo "lndKeysend=on" >> /mnt/hdd/raspiblitz.conf
echo "# OK - keysend feature is switched ON"
echo "# will be enfored by lnd.check.sh prestart"
echo "# LND or RaspiBlitz needs restart"
elif [ "${parameter}" == "off" ]; then
# just remove the parameter from the config file
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
sudo sed -i '/lndKeysend=.*/d' /mnt/hdd/raspiblitz.conf
sudo sed -i '/accept-keysend=.*/d' /mnt/hdd/lnd/lnd.conf 2>/dev/null
sudo sed -i '/accept-keysend=.*/d' /mnt/hdd/lnd/tlnd.conf 2>/dev/null
sudo sed -i '/accept-keysend=.*/d' /mnt/hdd/lnd/slnd.conf 2>/dev/null
echo "# OK - keysend feature is switched OFF"
echo "# OK - keysend enforcement is switched OFF"
echo "# LND or RaspiBlitz needs restart"
elif [ "${parameter}" == "status" ]; then
keysendOn=$(echo "${lndExtraParameter}" | grep -c 'accept-keysend')
keysendRunning=$(sudo systemctl status lnd | grep -c 'accept-keysend')
keysendOn=$(sudo cat /mnt/hdd/raspiblitz.conf | grep -c '^lndKeysend=on')
keysendRunning=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c '^accept-keysend\=true')
echo "keysendOn=${keysendOn}"
echo "keysendRunning=${keysendRunning}"