From 37df1b354d9ed882e7ffd2f44b1f6c76baecee37 Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Thu, 19 Dec 2024 19:13:29 +0100 Subject: [PATCH] Small Fixes for v1.11.4 (#4890) * v1.11.4rc1 & AlbyHub 1.12.0 * #4864 Core Lightning 24.11.1 * #4884 revert back to former version * #4891 account for pending closing balance (#4892) * #4876 adding Allow New User Switch * #4882 revert back to CLN v24.11 * #4893 temp re-introduce en_GB for v1.11.4 --- home.admin/BBcloseAllChannels.sh | 119 ++++-------------- home.admin/config.scripts/bonus.lnbits.sh | 32 ++++- home.admin/config.scripts/bonus.postgresql.sh | 6 + home.admin/config.scripts/cl.install.sh | 2 +- 4 files changed, 63 insertions(+), 96 deletions(-) diff --git a/home.admin/BBcloseAllChannels.sh b/home.admin/BBcloseAllChannels.sh index 57a8a7f8..9632d7f0 100755 --- a/home.admin/BBcloseAllChannels.sh +++ b/home.admin/BBcloseAllChannels.sh @@ -3,111 +3,42 @@ # load raspiblitz config data (with backup from old config) source /home/admin/raspiblitz.info source /mnt/hdd/raspiblitz.conf -if [ ${#network} -eq 0 ]; then network=$(cat .network); fi +if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network="bitcoin"; fi if [ ${#chain} -eq 0 ]; then chain=$(${network}-cli getblockchaininfo | jq -r '.chain') fi -source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2) - -if [ $LNTYPE = cl ];then - # https://lightning.readthedocs.io/lightning-close.7.html - peerlist=$($lightningcli_alias listpeers|grep '"id":'|awk '{print $2}'|cut -d, -f1) - # to display - function cl_closeall_command { - for i in $peerlist; do - # close id [unilateraltimeout] [destination] [fee_negotiation_step] [*wrong_funding*] - echo "$lightningcli_alias close $i 30;" - done - } - command=$(cl_closeall_command) - # to run - function cl_closeall { - for i in $peerlist; do - # close id [unilateraltimeout] [destination] [fee_negotiation_step] [*wrong_funding*] - echo "# Attempting a mutual close one-by-one with a 30 seconds timeout" - $lightningcli_alias close $i 30 - done - } -elif [ $LNTYPE = lnd ];then - # 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 0 - fi - - # 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 +# 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} --network=${chain}net closeallchannels --force" + clear -echo -echo "# Precheck" # PRECHECK) check if chain is in sync -if [ $LNTYPE = cl ];then - BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1) - CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight) - if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then - chainOutSync=0 - else - chainOutSync=1 - fi -elif [ $LNTYPE = lnd ];then - chainOutSync=$($lncli_alias getinfo | grep '"synced_to_chain": false' -c) -fi -if [ ${chainOutSync} -eq 1 ]; then - if [ $LNTYPE = cl ];then - echo "# FAIL PRECHECK - '${netprefix}lightning-cli getinfo' blockheight is different from '${netprefix}bitcoind getblockchaininfo' - wait until chain is sync " - elif [ $LNTYPE = lnd ];then - echo "# FAIL PRECHECK - ${netprefix}lncli getinfo shows 'synced_to_chain': false - wait until chain is sync " - fi - echo - echo "# PRESS ENTER to return to menu" - read key - exit 0 -else - echo "# OK - the chain is synced" -fi - -# raise high focus on lightning channels next 1 hour -/home/admin/_cache.sh focus ln_${LNTYPE}_${CHAIN}_channels_active 0 3600 -/home/admin/_cache.sh focus ln_${LNTYPE}_${CHAIN}_channels_inactive 0 3600 -/home/admin/_cache.sh focus ln_${LNTYPE}_${CHAIN}_channels_total 0 3600 - -echo "#####################################" -echo "# Closing All Channels (EXPERIMENTAL)" -echo "#####################################" -echo -echo "# COMMAND LINE: " +echo "***********************************" +echo "Closing All Channels (EXPERIMENTAL)" +echo "***********************************" +echo "" +echo "COMMAND LINE: " echo $command -echo -echo "# RESULT:" +echo "" +echo "RESULT:" + +# PRECHECK) check if chain is in sync +chainInSync=$(lncli --chain=${network} --network=${chain}net 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 - if [ $LNTYPE = cl ];then - cl_closeall - elif [ $LNTYPE = lnd ];then - ${command} - fi + ${command} fi - -echo -echo "# OK - please recheck if channels really closed" + +echo "" +echo "OK - please recheck if channels really closed" sleep 5 \ No newline at end of file diff --git a/home.admin/config.scripts/bonus.lnbits.sh b/home.admin/config.scripts/bonus.lnbits.sh index 7bef113e..33442390 100644 --- a/home.admin/config.scripts/bonus.lnbits.sh +++ b/home.admin/config.scripts/bonus.lnbits.sh @@ -234,6 +234,16 @@ Consider adding a IP2TOR Bridge under OPTIONS." OPTIONS+=(ADMINUI "Deactivate 'Admin UI'") fi + # Allow New Accounts (only if AdminUI is OFF) + allowNewAccountsFalse=$(sudo grep -c "LNBITS_ALLOW_NEW_ACCOUNTS=false" $lnbitsConfig) + if [ ${activatedAdminUI} -eq 0 ]; then + if [ ${allowNewAccountsFalse} -eq 0 ]; then + OPTIONS+=(NEWACCOUNTS "Disable New Accounts") + else + OPTIONS+=(NEWACCOUNTS "Enable New Accounts") + fi + fi + WIDTH=66 CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1")) HEIGHT=$((CHOICE_HEIGHT + 7)) @@ -306,7 +316,27 @@ Consider adding a IP2TOR Bridge under OPTIONS." sudo sed -i "/^LNBITS_ADMIN_UI=/d" $lnbitsConfig sudo bash -c "echo 'LNBITS_ADMIN_UI=false' >> ${lnbitsConfig}" fi - echo "Restarting LNbits ..." + echo "Restarting LNbits to activate new setting ..." + sudo systemctl restart lnbits + echo "PRESS ENTER to continue" + read key + exit 0 + ;; + NEWACCOUNTS) + clear + echo + if [ ${allowNewAccountsFalse} -eq 0 ]; then + echo "Disable New Accounts" + sudo sed -i "/^LNBITS_ALLOW_NEW_ACCOUNTS=/d" $lnbitsConfig + sudo sed -i "/^# LNBITS_ALLOW_NEW_ACCOUNTS=/d" $lnbitsConfig + sudo bash -c "echo 'LNBITS_ALLOW_NEW_ACCOUNTS=false' >> ${lnbitsConfig}" + else + echo "Enable New Accounts" + sudo sed -i "/^LNBITS_ALLOW_NEW_ACCOUNTS=/d" $lnbitsConfig + sudo sed -i "/^# LNBITS_ALLOW_NEW_ACCOUNTS=/d" $lnbitsConfig + sudo bash -c "echo 'LNBITS_ALLOW_NEW_ACCOUNTS=true' >> ${lnbitsConfig}" + fi + echo "Restarting LNbits to activate new setting ..." sudo systemctl restart lnbits echo "PRESS ENTER to continue" read key diff --git a/home.admin/config.scripts/bonus.postgresql.sh b/home.admin/config.scripts/bonus.postgresql.sh index 866d9cbb..1df7764b 100755 --- a/home.admin/config.scripts/bonus.postgresql.sh +++ b/home.admin/config.scripts/bonus.postgresql.sh @@ -35,6 +35,12 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo apt install -y postgresql-$PG_VERSION fi + # make sure en_GB locale is available for now - see #4893 + echo "# temp fixing locale" + sudo sed -i '/^#en_GB.UTF-8 UTF-8/s/^#//' /etc/locale.gen + sudo sed -i '/^# en_GB.UTF-8 UTF-8/s/^# //' /etc/locale.gen + sudo locale-gen + postgres_datadir="/var/lib/postgresql" # default data dir postgres_confdir="/etc/postgresql" # default conf dir diff --git a/home.admin/config.scripts/cl.install.sh b/home.admin/config.scripts/cl.install.sh index 3a03eb6e..9e1c179f 100644 --- a/home.admin/config.scripts/cl.install.sh +++ b/home.admin/config.scripts/cl.install.sh @@ -162,7 +162,7 @@ if [ "$1" = "install" ]; then exit 1 fi echo - echo "- OK the installation of Core Lightning v${installed} is successful" + echo "- OK the installation of Core Lightning ${installed} is successful" exit 0 fi