lnd autounlock if testnet and signet (#3212)

* lnd autounlock if testnet and signet

* check for header in the lnd.conf

* fix variables and improve output

* make grep more robust

* delete autounlock if passwordFile not present
This commit is contained in:
openoms 2022-07-12 12:59:04 +01:00 committed by GitHub
parent b33d2fcbd7
commit 4b35b77e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 4 deletions

View File

@ -61,6 +61,14 @@ if [ "$1" == "prestart" ]; then
/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED
fi
##### APPLICATION OPTIONS SECTION #####
# delete autounlock if passwordFile not present
passwordFile="/mnt/hdd/lnd/data/chain/${network}/${CHAIN}/password.info"
if ! ls ${passwordFile} &>/dev/null; then
sed -i "/^wallet-unlock-password-file=/d" ${lndConfFile}
fi
##### BITCOIN OPTIONS SECTION #####
# [bitcoin]

View File

@ -433,6 +433,26 @@ alias ${netprefix}lndconf=\"sudo nano /home/bitcoin/.lnd/${netprefix}lnd.conf\"\
fi
fi
if [ "${CHAIN}" != "mainnet" ]; then
echo "# Setting autounlock for ${CHAIN}"
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd ${CHAIN})
passwordFile="/mnt/hdd/lnd/data/chain/${network}/${CHAIN}/password.info"
# create passwordfile
if ! sudo ls ${passwordFile} &>/dev/null; then
echo "raspiblitz" | sudo -u bitcoin tee ${passwordFile} 1>/dev/null
fi
# add autounlock to lnd.conf
if ! grep "^wallet-unlock-password-file=${passwordFile}" < ${lndConfFile}; then
if grep "^\[Application Options\]" < ${lndConfFile} &>/dev/null; then
# add under header
sudo sed -i "/^\[Application Options\]$/awallet-unlock-password-file=${passwordFile}" ${lndConfFile}
else
# just append if no headers used
echo "wallet-unlock-password-file=${passwordFile}" | sudo -u bitcoin tee ${lndConfFile}
fi
fi
fi
echo
echo "# The installed LND version is: $(sudo -u bitcoin /usr/local/bin/lnd --version)"
echo

View File

@ -18,11 +18,15 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
exit 1
fi
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ "$1" = getvars ];then
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ];then
network=bitcoin
fi
# LNTYPE is: lnd | cl
if [ $# -gt 1 ];then
LNTYPE=$2