raspiblitz/home.admin/BBcloseAllChannels.sh
2018-11-18 12:42:13 +01:00

34 lines
834 B
Bash
Executable File

#!/bin/bash
# load network and chain info
network=`cat .network`
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
command="lncli --chain=${network} closeallchannels --force"
clear
echo "***********************************"
echo "Closing All Channels (EXPERIMENTAL)"
echo "***********************************"
echo ""
echo "COMMAND LINE: "
echo $command
echo ""
echo "RESULT:"
# PRECHECK) check if chain is in sync
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
if [ ${chainInSync} -eq 0 ]; then
command=""
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
fi
# execute command
if [ ${#command} -gt 0 ]; then
${command}
fi
echo ""
echo "OK - please recheck if channels really closed"
sleep 5