mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +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.$$"
|
||||
_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
|
||||
|
||||
# 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
|
||||
maxAmount=$(lncli --chain=${network} walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||
|
||||
# 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)
|
||||
|
||||
# TODO: pre-check user hast more than 0 sat in on-chain wallet to send
|
||||
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:"
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ "${autoPilot}" = "on" ]; then
|
||||
echo "*** IMPORTANT **********************************"
|
||||
echo "You need to turn OFF the LND AutoPilot first,"
|
||||
echo "so that closed channels are not opening up again."
|
||||
echo "You find the AutoPilot -----> SERVICES section"
|
||||
echo "************************************************"
|
||||
exit 1
|
||||
# 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
|
||||
|
||||
# load network and chain info
|
||||
network=`cat .network`
|
||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||
# precheck: AutoPilot
|
||||
if [ "${autoPilot}" = "on" ]; then
|
||||
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"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue