deprecate Testnet in SETTINGS

keysend and autopilot only for mainnet

due to: https://github.com/rootzoll/raspiblitz/issues/2290
This commit is contained in:
openoms 2021-06-27 23:36:27 +01:00
parent 4f80c0d477
commit 0ca90f3f23
No known key found for this signature in database
GPG key ID: 5BFB77609B081B65
2 changed files with 93 additions and 88 deletions

View file

@ -83,9 +83,11 @@ if [ "${displayClass}" == "lcd" ]; then
OPTIONS+=(s 'Touchscreen' ${touchscreenMenu}) OPTIONS+=(s 'Touchscreen' ${touchscreenMenu})
OPTIONS+=(r 'LCD Rotate' ${lcdrotateMenu}) OPTIONS+=(r 'LCD Rotate' ${lcdrotateMenu})
fi fi
OPTIONS+=(a 'Channel Autopilot' ${autoPilot}) if [ ${chain} = "main" ];then
OPTIONS+=(k 'Accept Keysend' ${keysend}) OPTIONS+=(a 'Channel Autopilot' ${autoPilot})
# OPTIONS+=(n 'Testnet' ${chainValue}) #TODO remove related code OPTIONS+=(k 'Accept Keysend' ${keysend})
fi
# OPTIONS+=(n 'Testnet' ${chainValue})
OPTIONS+=(c 'Circuitbreaker (LND firewall)' ${circuitbreaker}) OPTIONS+=(c 'Circuitbreaker (LND firewall)' ${circuitbreaker})
OPTIONS+=(u 'LND Auto-Unlock' ${autoUnlock}) OPTIONS+=(u 'LND Auto-Unlock' ${autoUnlock})
OPTIONS+=(d 'StaticChannelBackup on DropBox' ${DropboxBackup}) OPTIONS+=(d 'StaticChannelBackup on DropBox' ${DropboxBackup})
@ -121,91 +123,92 @@ fi
needsReboot=0 needsReboot=0
anychange=0 anychange=0
# TESTNET process choice - KEEP FIRST IN ORDER # deprecated - see https://github.com/rootzoll/raspiblitz/issues/2290
choice="main"; check=$(echo "${CHOICES}" | grep -c "n") ## TESTNET process choice - KEEP FIRST IN ORDER
if [ ${check} -eq 1 ]; then choice="test"; fi #choice="main"; check=$(echo "${CHOICES}" | grep -c "n")
if [ "${chain}" != "${choice}" ]; then #if [ ${check} -eq 1 ]; then choice="test"; fi
if [ "${network}" = "litecoin" ] && [ "${choice}"="test" ]; then #if [ "${chain}" != "${choice}" ]; then
dialog --title 'FAIL' --msgbox 'Litecoin-Testnet not available.' 5 25 # if [ "${network}" = "litecoin" ] && [ "${choice}"="test" ]; then
elif [ "${BTCRPCexplorer}" = "on" ]; then # dialog --title 'FAIL' --msgbox 'Litecoin-Testnet not available.' 5 25
dialog --title 'NOTICE' --msgbox 'Please turn off BTC-RPC-Explorer FIRST\nbefore changing testnet.' 6 45 # elif [ "${BTCRPCexplorer}" = "on" ]; then
exit 1 # dialog --title 'NOTICE' --msgbox 'Please turn off BTC-RPC-Explorer FIRST\nbefore changing testnet.' 6 45
elif [ "${BTCPayServer}" = "on" ]; then # exit 1
dialog --title 'NOTICE' --msgbox 'Please turn off BTC-Pay-Server FIRST\nbefore changing testnet.' 6 45 # elif [ "${BTCPayServer}" = "on" ]; then
exit 1 # dialog --title 'NOTICE' --msgbox 'Please turn off BTC-Pay-Server FIRST\nbefore changing testnet.' 6 45
elif [ "${ElectRS}" = "on" ]; then # exit 1
dialog --title 'NOTICE' --msgbox 'Please turn off Electrum-Rust-Server FIRST\nbefore changing testnet.' 6 48 # elif [ "${ElectRS}" = "on" ]; then
exit 1 # dialog --title 'NOTICE' --msgbox 'Please turn off Electrum-Rust-Server FIRST\nbefore changing testnet.' 6 48
elif [ "${loop}" = "on" ]; then # exit 1
dialog --title 'NOTICE' --msgbox 'Please turn off Loop-Service FIRST\nbefore changing testnet.' 6 48 # elif [ "${loop}" = "on" ]; then
exit 1 # dialog --title 'NOTICE' --msgbox 'Please turn off Loop-Service FIRST\nbefore changing testnet.' 6 48
else # exit 1
echo "Testnet Setting changed .." # else
anychange=1 # echo "Testnet Setting changed .."
sudo /home/admin/config.scripts/network.chain.sh ${choice}net # anychange=1
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${choice}net/wallet.db 2>/dev/null | grep -c 'wallet.db') # sudo /home/admin/config.scripts/network.chain.sh ${choice}net
if [ ${walletExists} -eq 0 ]; then # walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${choice}net/wallet.db 2>/dev/null | grep -c 'wallet.db')
echo "Need to creating a new wallet ... wait 20secs" # if [ ${walletExists} -eq 0 ]; then
sudo systemctl start lnd # echo "Need to creating a new wallet ... wait 20secs"
sleep 20 # sudo systemctl start lnd
tryAgain=1 # sleep 20
while [ ${tryAgain} -eq 1 ] # tryAgain=1
do # while [ ${tryAgain} -eq 1 ]
echo "****************************************************************************" # do
echo "Creating a new LND Wallet for ${network}/${choice}net" # echo "****************************************************************************"
echo "****************************************************************************" # echo "Creating a new LND Wallet for ${network}/${choice}net"
echo "A) For 'Wallet Password' use your PASSWORD C --> !! minimum 8 characters !!" # echo "****************************************************************************"
echo "B) Answer 'n' because you don't have a 'cipher seed mnemonic' (24 words) yet" # echo "A) For 'Wallet Password' use your PASSWORD C --> !! minimum 8 characters !!"
echo "C) For 'passphrase' to encrypt your 'cipher seed' use PASSWORD D (optional)" # echo "B) Answer 'n' because you don't have a 'cipher seed mnemonic' (24 words) yet"
echo "****************************************************************************" # echo "C) For 'passphrase' to encrypt your 'cipher seed' use PASSWORD D (optional)"
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd ${choice}net) # echo "****************************************************************************"
$lncli_alias create 2>error.out # source <(/home/admin/config.scripts/network.aliases.sh getvars lnd ${choice}net)
error=$(sudo cat error.out) # $lncli_alias create 2>error.out
if [ ${#error} -eq 0 ]; then # error=$(sudo cat error.out)
sleep 2 # if [ ${#error} -eq 0 ]; then
# WIN # sleep 2
tryAgain=0 # # WIN
echo "!!! Make sure to write down the 24 words (cipher seed mnemonic) !!!" # tryAgain=0
echo "If you are ready. Press ENTER." # echo "!!! Make sure to write down the 24 words (cipher seed mnemonic) !!!"
else # echo "If you are ready. Press ENTER."
# FAIL # else
tryAgain=1 # # FAIL
echo "!!! FAIL ---> SOMETHING WENT WRONG !!!" # tryAgain=1
echo "${error}" # echo "!!! FAIL ---> SOMETHING WENT WRONG !!!"
echo "Press ENTER to retry ... or CTRL-c to EXIT" # echo "${error}"
fi # echo "Press ENTER to retry ... or CTRL-c to EXIT"
read key # fi
done # read key
echo "Check for Macaroon .. (10sec)" # done
sleep 10 # echo "Check for Macaroon .. (10sec)"
macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon') # sleep 10
if [ ${macaroonExists} -eq 0 ]; then # macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon')
echo "*** PLEASE UNLOCK your wallet with PASSWORD C to create macaroon" # if [ ${macaroonExists} -eq 0 ]; then
lncli unlock 2>/dev/null # echo "*** PLEASE UNLOCK your wallet with PASSWORD C to create macaroon"
sleep 6 # lncli unlock 2>/dev/null
fi # sleep 6
macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon') # fi
if [ ${macaroonExists} -eq 0 ]; then # macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon')
echo "FAIL --> Was not able to create macaroon" # if [ ${macaroonExists} -eq 0 ]; then
echo "Please report problem." # echo "FAIL --> Was not able to create macaroon"
exit 1 # echo "Please report problem."
fi # exit 1
echo "stopping lnd again" # fi
sleep 5 # echo "stopping lnd again"
sudo systemctl stop lnd # sleep 5
fi # sudo systemctl stop lnd
# fi
echo "Update Admin Macaroon" #
sudo rm -r /home/admin/.lnd/data/chain/${network}/${choice}net 2>/dev/null # echo "Update Admin Macaroon"
sudo mkdir /home/admin/.lnd/data/chain/${network}/${choice}net # sudo rm -r /home/admin/.lnd/data/chain/${network}/${choice}net 2>/dev/null
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon /home/admin/.lnd/data/chain/${network}/${choice}net # sudo mkdir /home/admin/.lnd/data/chain/${network}/${choice}net
sudo chown -R admin:admin /home/admin/.lnd/ # sudo cp /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon /home/admin/.lnd/data/chain/${network}/${choice}net
# sudo chown -R admin:admin /home/admin/.lnd/
needsReboot=1 #
fi # needsReboot=1
else # fi
echo "Testnet Setting unchanged." # else
fi # echo "Testnet Setting unchanged."
# fi
# AUTOPILOT process choice # AUTOPILOT process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "a") choice="off"; check=$(echo "${CHOICES}" | grep -c "a")

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
# deprecated - see: https://github.com/rootzoll/raspiblitz/issues/2290
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to change between testnet and mainnet" echo "small config script to change between testnet and mainnet"