@ -2,17 +2,39 @@
_temp = " ./download/dialog. $$ "
_error = "./.error.out"
# load network and chain info
network = ` cat .network`
chain = $( ${ network } -cli -datadir= /home/bitcoin/.${ network } getblockchaininfo | jq -r '.chain' )
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
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
# get available amount in on-chain wallet
maxAmount = $( lncli --chain= ${ network } walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
# 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
# TODO: pre-check if channels are open or are still in closing
# and let user know not all funds are available yet (just info Dialoge)
# 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
# TODO: pre-check user hast more than 0 sat in on-chain wallet to send
# get available amount in on-chain wallet
maxAmount = $( lncli --chain= ${ network } walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
if [ ${ maxAmount } -gt 0 ] ; then
dialog --title 'Info' --msgbox "You have 0 moveable funds available.\nNOTICE: Just confirmed on-chain funds can be moved." 6 58
exit 1
fi
# let user enter the amount
l1 = "Enter the amount of funds you want to send/remove:"