diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 21fca8145..befdd3fb4 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -75,6 +75,10 @@ else lnchannels "Lightning Channel List") # Depending Options + openChannels=$(sudo -u bitcoin lncli listchannels 2>/dev/null | grep chan_id -c) + if [ ${openChannels} -gt 0 ]; then + OPTIONS+=(CLOSEALL "Close all open Channels") + fi if [ "${network}" = "bitcoin" ]; then OPTIONS+=(SWITCH "Switch ${switchOption}") fi @@ -149,6 +153,12 @@ case $CHOICE in read key ./00mainMenu.sh ;; + CLOSEALL) + ./BBcloseAllChannels.sh + echo "Press ENTER to return to main menu." + read key + ./00mainMenu.sh + ;; SWITCH) sudo ./95switchMainTest.sh echo "Press ENTER to return to main menu." diff --git a/home.admin/BBcloseAllChannels.sh b/home.admin/BBcloseAllChannels.sh index c349fc415..6b0602e7a 100755 --- a/home.admin/BBcloseAllChannels.sh +++ b/home.admin/BBcloseAllChannels.sh @@ -23,17 +23,25 @@ if [ ${chainInSync} -eq 0 ]; then result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync " fi -# TODO PRECHECK) are any channels open at all - -# TODO PRECHECK) are there INACTIVE channels that would need a force close (and manual YES) -# remember that for info below - # execute command if [ ${#command} -gt 0 ]; then ${command} fi echo "" -echo "OK your list of channels looks now like this:" +echo "OK" sleep 2 -lnchannels + +openChannels=$(sudo -u bitcoin lncli listchannels 2>/dev/null | grep chan_id -c) +if [ ${openChannels} -gt 0 ]; then + echo "" + echo "*******************" + echo "OK All Channels are closed now." + echo "You can now switch test/main or update RaspiBlitz safely, as long as you got your CIPHER WORD LIST SEED." + echo "*******************" +else + echo "!! WARNING you still have open channels:" + lnchannels +fi + +