mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 22:58:43 +01:00
updated to new config and added more edge case info
This commit is contained in:
parent
2047a0b456
commit
3b7d7748fa
2 changed files with 40 additions and 19 deletions
|
@ -2,17 +2,39 @@
|
||||||
_temp="./download/dialog.$$"
|
_temp="./download/dialog.$$"
|
||||||
_error="./.error.out"
|
_error="./.error.out"
|
||||||
|
|
||||||
# load network and chain info
|
# load raspiblitz config data (with backup from old config)
|
||||||
network=`cat .network`
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
||||||
|
if [ ${#chain} -eq 0 ]; then
|
||||||
|
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if user has money in lightning channels - info about close all
|
||||||
|
openChannels=$(lncli --chain=${network} listchannels 2>/dev/null | jq '.[] | length')
|
||||||
|
if [ ${#openChannels} -eq 0 ]; then
|
||||||
|
echo "*** IMPORTANT **********************************"
|
||||||
|
echo "It looks like LND is not responding."
|
||||||
|
echo "Still starting up, is locked or is not running?"
|
||||||
|
echo "Try later, try reboot or check ./XXdebugLogs.sh"
|
||||||
|
echo "************************************************"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ${openChannels} -gt 0 ]; then
|
||||||
|
dialog --title 'Info' --msgbox 'You still have funds in open Lightning Channels.\nUse CLOSEALL first if you want to cashout all funds.\nNOTICE: Just confirmed on-chain funds can be moved.' 7 58
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if money is waiting to get confirmed
|
||||||
|
unconfirmed=$(lncli --chain=${network} walletbalance | grep '"unconfirmed_balance"' | cut -d '"' -f4)
|
||||||
|
if [ ${unconfirmed} -gt 0 ]; then
|
||||||
|
dialog --title 'Info' --msgbox "Still waiting confirmation for ${unconfirmed} sat.\nNOTICE: Just confirmed on-chain funds can be moved." 6 58
|
||||||
|
fi
|
||||||
|
|
||||||
# get available amount in on-chain wallet
|
# get available amount in on-chain wallet
|
||||||
maxAmount=$(lncli --chain=${network} walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
maxAmount=$(lncli --chain=${network} walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||||
|
if [ ${maxAmount} -gt 0 ]; then
|
||||||
# TODO: pre-check if channels are open or are still in closing
|
dialog --title 'Info' --msgbox "You have 0 moveable funds available.\nNOTICE: Just confirmed on-chain funds can be moved." 6 58
|
||||||
# and let user know not all funds are available yet (just info Dialoge)
|
exit 1
|
||||||
|
fi
|
||||||
# TODO: pre-check user hast more than 0 sat in on-chain wallet to send
|
|
||||||
|
|
||||||
# let user enter the amount
|
# let user enter the amount
|
||||||
l1="Enter the amount of funds you want to send/remove:"
|
l1="Enter the amount of funds you want to send/remove:"
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
# load raspiblitz config data (with backup from old config)
|
||||||
if [ "${autoPilot}" = "on" ]; then
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
echo "*** IMPORTANT **********************************"
|
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
||||||
echo "You need to turn OFF the LND AutoPilot first,"
|
if [ ${#chain} -eq 0 ]; then
|
||||||
echo "so that closed channels are not opening up again."
|
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||||
echo "You find the AutoPilot -----> SERVICES section"
|
|
||||||
echo "************************************************"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# load network and chain info
|
# precheck: AutoPilot
|
||||||
network=`cat .network`
|
if [ "${autoPilot}" = "on" ]; then
|
||||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
dialog --title 'Info' --msgbox 'You need to turn OFF the LND AutoPilot first,\nso that closed channels are not opening up again.\nYou find the AutoPilot -----> SERVICES section' 7 55
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
command="lncli --chain=${network} closeallchannels --force"
|
command="lncli --chain=${network} closeallchannels --force"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue