add SWITCHLN to lndMenu and clnMenu

This commit is contained in:
openoms
2021-05-28 20:28:56 +01:00
parent 8d0dae14c7
commit 7291e54174
4 changed files with 153 additions and 124 deletions

View File

@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
# 00infoBlitz.sh <cln|lnd> <testnet|mainnet|signet>
# load code software version # load code software version
source /home/admin/_version.info source /home/admin/_version.info
@@ -14,10 +16,6 @@ color_gray='\033[0;37m'
source /home/admin/raspiblitz.info 2>/dev/null source /home/admin/raspiblitz.info 2>/dev/null
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ $# -gt 0 ];then
CHAIN=$1
chain=${CHAIN::-3}
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2) source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
shopt -s expand_aliases shopt -s expand_aliases
alias bitcoincli_alias="$bitcoincli_alias" alias bitcoincli_alias="$bitcoincli_alias"

View File

@@ -45,6 +45,11 @@ if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
HEIGHT=$((HEIGHT+1)) HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1)) CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi fi
if [ ${#LNdefault} -gt 0 ]&&[ $LNdefault = lnd ];then
OPTIONS+=(SWITCHLN "Use C-lightning as default")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
#TODO OPTIONS+=(CASHOUT "Remove Funds from LND") #TODO OPTIONS+=(CASHOUT "Remove Funds from LND")
@@ -59,64 +64,74 @@ CHOICE=$(dialog --clear \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
case $CHOICE in case $CHOICE in
lnbalance) lnbalance)
clear clear
echo "*** YOUR SATOSHI BALANCES ***" echo "*** YOUR SATOSHI BALANCES ***"
/home/admin/config.scripts/lnd.balance.sh ${network} /home/admin/config.scripts/lnd.balance.sh ${network}
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
lnchannels) lnchannels)
clear clear
echo "*** YOUR LIGHTNING CHANNELS ***" echo "*** YOUR LIGHTNING CHANNELS ***"
echo "" echo ""
echo "Capacity -> total sats in the channel (their side + your side)" echo "Capacity -> total sats in the channel (their side + your side)"
echo "Commit-Fee -> the fee that's charged if either side of the channel closes" echo "Commit-Fee -> the fee that's charged if either side of the channel closes"
echo "Balance-Local -> sats on your side of the channel (outbound liquidity)" echo "Balance-Local -> sats on your side of the channel (outbound liquidity)"
echo "Balance-Remote -> sats on their side of the channel (inbound liquidity)" echo "Balance-Remote -> sats on their side of the channel (inbound liquidity)"
echo "Fee-Base -> fixed fee (in millisatoshis) per forwarding on channel" echo "Fee-Base -> fixed fee (in millisatoshis) per forwarding on channel"
echo "Fee-PerMil -> amount based fee (millisatoshis per 1 satoshi) on forwarding" echo "Fee-PerMil -> amount based fee (millisatoshis per 1 satoshi) on forwarding"
/home/admin/config.scripts/lnd.channels.sh ${network} /home/admin/config.scripts/lnd.channels.sh ${network}
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
lnfwdreport) lnfwdreport)
/home/admin/config.scripts/lnd.fwdreport.sh -menu /home/admin/config.scripts/lnd.fwdreport.sh -menu
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
PEERING) PEERING)
/home/admin/BBconnectPeer.sh cln $NETWORK /home/admin/BBconnectPeer.sh cln $NETWORK
;; ;;
FUNDING) FUNDING)
/home/admin/BBfundWallet.sh cln $NETWORK /home/admin/BBfundWallet.sh cln $NETWORK
;; ;;
CASHOUT) CASHOUT)
/home/admin/BBcashoutWallet.sh /home/admin/BBcashoutWallet.sh
;; ;;
CHANNEL) CHANNEL)
/home/admin/BBopenChannel.sh cln $NETWORK /home/admin/BBopenChannel.sh cln $NETWORK
;; ;;
SEND) SEND)
/home/admin/BBpayInvoice.sh cln $NETWORK /home/admin/BBpayInvoice.sh cln $NETWORK
;; ;;
RECEIVE) RECEIVE)
/home/admin/BBcreateInvoice.sh cln $NETWORK /home/admin/BBcreateInvoice.sh cln $NETWORK
;; ;;
NAME) NAME)
sudo /home/admin/config.scripts/lnd.setname.sh sudo /home/admin/config.scripts/lnd.setname.sh
noreboot=$? noreboot=$?
if [ "${noreboot}" = "0" ]; then if [ "${noreboot}" = "0" ]; then
sudo -u bitcoin ${network}-cli stop sudo -u bitcoin ${network}-cli stop
echo "Press ENTER to Reboot." echo "Press ENTER to Reboot."
read key read key
sudo /home/admin/XXshutdown.sh reboot sudo /home/admin/XXshutdown.sh reboot
exit 0 exit 0
fi fi
;; ;;
CLOSEALL) CLOSEALL)
/home/admin/BBcloseAllChannels.sh /home/admin/BBcloseAllChannels.sh
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
SWITCHLN)
clear
echo
# setting value in raspi blitz config
sudo sed -i "s/^LNdefault=.*/LNdefault=cln/g" /mnt/hdd/raspiblitz.conf
echo "# OK - LNdefault=cln is set in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."
read key
;;
esac esac

View File

@@ -41,6 +41,11 @@ if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
fi fi
OPTIONS+=(CASHOUT "Remove Funds from LND") OPTIONS+=(CASHOUT "Remove Funds from LND")
if [ ${#LNdefault} -gt 0 ]&&[ $LNdefault = cln ];then
OPTIONS+=(SWITCHLN "Use LND as default")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
CHOICE=$(dialog --clear \ CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
@@ -53,64 +58,74 @@ CHOICE=$(dialog --clear \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
case $CHOICE in case $CHOICE in
lnbalance) lnbalance)
clear clear
echo "*** YOUR SATOSHI BALANCES ***" echo "*** YOUR SATOSHI BALANCES ***"
/home/admin/config.scripts/lnd.balance.sh ${network} /home/admin/config.scripts/lnd.balance.sh ${network}
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
lnchannels) lnchannels)
clear clear
echo "*** YOUR LIGHTNING CHANNELS ***" echo "*** YOUR LIGHTNING CHANNELS ***"
echo "" echo ""
echo "Capacity -> total sats in the channel (their side + your side)" echo "Capacity -> total sats in the channel (their side + your side)"
echo "Commit-Fee -> the fee that's charged if either side of the channel closes" echo "Commit-Fee -> the fee that's charged if either side of the channel closes"
echo "Balance-Local -> sats on your side of the channel (outbound liquidity)" echo "Balance-Local -> sats on your side of the channel (outbound liquidity)"
echo "Balance-Remote -> sats on their side of the channel (inbound liquidity)" echo "Balance-Remote -> sats on their side of the channel (inbound liquidity)"
echo "Fee-Base -> fixed fee (in millisatoshis) per forwarding on channel" echo "Fee-Base -> fixed fee (in millisatoshis) per forwarding on channel"
echo "Fee-PerMil -> amount based fee (millisatoshis per 1 satoshi) on forwarding" echo "Fee-PerMil -> amount based fee (millisatoshis per 1 satoshi) on forwarding"
/home/admin/config.scripts/lnd.channels.sh ${network} /home/admin/config.scripts/lnd.channels.sh ${network}
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
lnfwdreport) lnfwdreport)
/home/admin/config.scripts/lnd.fwdreport.sh -menu /home/admin/config.scripts/lnd.fwdreport.sh -menu
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
PEERING) PEERING)
/home/admin/BBconnectPeer.sh /home/admin/BBconnectPeer.sh
;; ;;
FUNDING) FUNDING)
/home/admin/BBfundWallet.sh /home/admin/BBfundWallet.sh
;; ;;
CASHOUT) CASHOUT)
/home/admin/BBcashoutWallet.sh /home/admin/BBcashoutWallet.sh
;; ;;
CHANNEL) CHANNEL)
/home/admin/BBopenChannel.sh /home/admin/BBopenChannel.sh
;; ;;
SEND) SEND)
/home/admin/BBpayInvoice.sh /home/admin/BBpayInvoice.sh
;; ;;
RECEIVE) RECEIVE)
/home/admin/BBcreateInvoice.sh /home/admin/BBcreateInvoice.sh
;; ;;
NAME) NAME)
sudo /home/admin/config.scripts/lnd.setname.sh sudo /home/admin/config.scripts/lnd.setname.sh
noreboot=$? noreboot=$?
if [ "${noreboot}" = "0" ]; then if [ "${noreboot}" = "0" ]; then
sudo -u bitcoin ${network}-cli stop sudo -u bitcoin ${network}-cli stop
echo "Press ENTER to Reboot." echo "Press ENTER to Reboot."
read key read key
sudo /home/admin/XXshutdown.sh reboot sudo /home/admin/XXshutdown.sh reboot
exit 0 exit 0
fi fi
;; ;;
CLOSEALL) CLOSEALL)
/home/admin/BBcloseAllChannels.sh /home/admin/BBcloseAllChannels.sh
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
SWITCHLN)
clear
echo
# setting value in raspi blitz config
sudo sed -i "s/^LNdefault=.*/LNdefault=lnd/g" /mnt/hdd/raspiblitz.conf
echo "# OK - LNdefault=lnd is set in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."
read key
;;
esac esac

View File

@@ -129,6 +129,7 @@ function status() {
while : while :
do do
# show the same info as on LCD screen # show the same info as on LCD screen
# 00infoBlitz.sh <cln|lnd> <testnet|mainnet|signet>
/home/admin/00infoBlitz.sh $1 $2 /home/admin/00infoBlitz.sh $1 $2
# wait 6 seconds for user exiting loop # wait 6 seconds for user exiting loop
#echo #echo