use cln sync detection and progress

This commit is contained in:
rootzoll 2021-07-25 00:55:02 +02:00
parent af4b604050
commit 70ad40f809
3 changed files with 6 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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}"