From 70ad40f809547c3fbcbed3b81d584d22dee2a9b3 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 25 Jul 2021 00:55:02 +0200 Subject: [PATCH] use cln sync detection and progress --- home.admin/00infoLCD.sh | 6 +++--- home.admin/config.scripts/blitz.statusscan.sh | 4 ++-- home.admin/setup.scripts/eventBlockchainSync.sh | 7 +------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/home.admin/00infoLCD.sh b/home.admin/00infoLCD.sh index c8e12b766..ad1c83f19 100755 --- a/home.admin/00infoLCD.sh +++ b/home.admin/00infoLCD.sh @@ -102,9 +102,9 @@ while : fi # TODO: ALSO SEPERATE GUI/ACTION FOR THE SCANNING / WALLET UNLOCK / ERROR DETECTION - # if LND is syncing or scanning - lndSynced=$($lncli_alias getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true) - if [ ${lndSynced} -eq 0 ]; then + # if lightning is syncing or scanning + source <(sudo /home/admin/config.scripts/blitz.statusscan.sh) + if [ "${syncedToChain}" != "1" ]; then /home/admin/setup.scripts/eventBlockchainSync.sh lcd sleep 10 continue diff --git a/home.admin/config.scripts/blitz.statusscan.sh b/home.admin/config.scripts/blitz.statusscan.sh index 5fbcf7bff..789299e30 100755 --- a/home.admin/config.scripts/blitz.statusscan.sh +++ b/home.admin/config.scripts/blitz.statusscan.sh @@ -274,14 +274,14 @@ echo "clnActive=${clnRunning}" if [ ${clnRunning} -eq 1 ]; then clnInfo=$(sudo -u bitcoin lightning-cli getinfo) clnBlockHeight=$(echo "${clnInfo}" | jq -r '.blockheight' | tr -cd '[[:digit:]]') + scanProgress=$(echo "scale=2; $clnBlockHeight*100/$total" | bc) + echo "scanProgress=${scanProgress}" clnBlockHeightPlusOne=$(expr $clnBlockHeight + 1) if [ "${total}" == "${clnBlockHeight}" ] || [ "${total}" == "${clnBlockHeightPlusOne}" ]; then echo "syncedToChain=1" else echo "syncedToChain=0" fi - scanProgress=$(echo "scale=2; $clnBlockHeight*100/$total" | bc) - echo "scanProgress=${scanProgress}" fi # touchscreen statistics diff --git a/home.admin/setup.scripts/eventBlockchainSync.sh b/home.admin/setup.scripts/eventBlockchainSync.sh index e2da56e5a..c4141f3d8 100644 --- a/home.admin/setup.scripts/eventBlockchainSync.sh +++ b/home.admin/setup.scripts/eventBlockchainSync.sh @@ -65,13 +65,8 @@ do # setting info string infoStr=" Blockchain Progress : ${syncProgress}\n" - if [ "${lightning}" == "lnd" ]; then - # if LND is active + if [ "${lightning}" == "lnd" ] || [ "${lightning}" == "cln" ]; then infoStr="${infoStr} Lightning Progress : ${scanProgress}\n ${actionString}" - elif [ "${lightning}" == "cln" ]; then - # if CLN is active - # TODO: show a scan progress of C-Lightning - infoStr="${infoStr} Lightning Progress : TODO\n ${actionString}" else # if lightning is deactivated (leave line clear) infoStr="${infoStr} \n ${actionString}"