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 fi
# TODO: ALSO SEPERATE GUI/ACTION FOR THE SCANNING / WALLET UNLOCK / ERROR DETECTION # TODO: ALSO SEPERATE GUI/ACTION FOR THE SCANNING / WALLET UNLOCK / ERROR DETECTION
# if LND is syncing or scanning # if lightning is syncing or scanning
lndSynced=$($lncli_alias getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true) source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
if [ ${lndSynced} -eq 0 ]; then if [ "${syncedToChain}" != "1" ]; then
/home/admin/setup.scripts/eventBlockchainSync.sh lcd /home/admin/setup.scripts/eventBlockchainSync.sh lcd
sleep 10 sleep 10
continue continue

View File

@ -274,14 +274,14 @@ echo "clnActive=${clnRunning}"
if [ ${clnRunning} -eq 1 ]; then if [ ${clnRunning} -eq 1 ]; then
clnInfo=$(sudo -u bitcoin lightning-cli getinfo) clnInfo=$(sudo -u bitcoin lightning-cli getinfo)
clnBlockHeight=$(echo "${clnInfo}" | jq -r '.blockheight' | tr -cd '[[:digit:]]') clnBlockHeight=$(echo "${clnInfo}" | jq -r '.blockheight' | tr -cd '[[:digit:]]')
scanProgress=$(echo "scale=2; $clnBlockHeight*100/$total" | bc)
echo "scanProgress=${scanProgress}"
clnBlockHeightPlusOne=$(expr $clnBlockHeight + 1) clnBlockHeightPlusOne=$(expr $clnBlockHeight + 1)
if [ "${total}" == "${clnBlockHeight}" ] || [ "${total}" == "${clnBlockHeightPlusOne}" ]; then if [ "${total}" == "${clnBlockHeight}" ] || [ "${total}" == "${clnBlockHeightPlusOne}" ]; then
echo "syncedToChain=1" echo "syncedToChain=1"
else else
echo "syncedToChain=0" echo "syncedToChain=0"
fi fi
scanProgress=$(echo "scale=2; $clnBlockHeight*100/$total" | bc)
echo "scanProgress=${scanProgress}"
fi fi
# touchscreen statistics # touchscreen statistics

View File

@ -65,13 +65,8 @@ do
# setting info string # setting info string
infoStr=" Blockchain Progress : ${syncProgress}\n" infoStr=" Blockchain Progress : ${syncProgress}\n"
if [ "${lightning}" == "lnd" ]; then if [ "${lightning}" == "lnd" ] || [ "${lightning}" == "cln" ]; then
# if LND is active
infoStr="${infoStr} Lightning Progress : ${scanProgress}\n ${actionString}" 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 else
# if lightning is deactivated (leave line clear) # if lightning is deactivated (leave line clear)
infoStr="${infoStr} \n ${actionString}" infoStr="${infoStr} \n ${actionString}"