Enhance BBcloseAllChannels.sh to allow LND user selection for channel closing method (#4886)

Enhance BBcloseAllChannels.sh to allow user selection for channel closing method. Users can now choose between COOP for cooperative close and FORCE for forced close
This commit is contained in:
HODLmeTight 2024-12-18 23:54:31 +01:00 committed by rootzoll
parent 0edc9a778a
commit 37851bf278

View File

@ -36,7 +36,25 @@ elif [ $LNTYPE = lnd ];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 0
fi
command="$lncli_alias closeallchannels --force"
# User choice for close type
close_type=$(dialog --clear \
--title "LND Channel Close Type" \
--menu "Choose how to close channels:" \
14 54 3 \
"COOP" "Attempt Cooperative Close" \
"FORCE" "Force Close Channels" \
2>&1 >/dev/tty)
# Set command based on user choice
if [ "$close_type" = "COOP" ]; then
command="$lncli_alias closeallchannels"
elif [ "$close_type" = "FORCE" ]; then
command="$lncli_alias closeallchannels --force"
else
echo "Invalid choice. Exiting."
exit 1
fi
fi
clear
@ -85,7 +103,7 @@ echo "# RESULT:"
if [ ${#command} -gt 0 ]; then
if [ $LNTYPE = cl ];then
cl_closeall
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ];then
${command}
fi
fi