diff --git a/home.admin/70initLND.sh b/home.admin/70initLND.sh index 1b467c7..f3ec96d 100755 --- a/home.admin/70initLND.sh +++ b/home.admin/70initLND.sh @@ -27,34 +27,27 @@ fi echo "OK - ${network}d is running" echo "" -###### Wait for Blochain Sync --> LET DO THIS LATER ON LND SCAN -#echo "*** Syncing Blockchain ***" -#ready=0 -#while [ ${ready} -eq 0 ] -# do -# progress="$(sudo -u bitcoin ${network}-cli getblockchaininfo | jq -r '.verificationprogress')" -# verySmallProgress=$(echo $progress | grep -c 'e-'); -# if [ ${verySmallProgress} -eq 1 ]; then -# progress="0.00"; -# fi -# ready=$(echo $progress'>0.99' | bc -l) -# sync_percentage=$(printf "%.2f%%" "$(echo $progress | awk '{print 100 * $1}')") -# #echo "progress($progress) verySmallProgress($verySmallProgress) ready($ready) sync_percentage($sync_percentage)" -# if [ ${#ready} -eq 0 ]; then -# echo "waiting for init ... can take a while" -# ready=0 -# elif [ "$sync_percentage" = "0.00%" ]; then -# echo "waiting for network ... can take a while" -# ready=0 -# elif [ ${ready} -eq 0 ]; then -# echo "${sync_percentage}" -# else -# echo "finishing sync ... can take a while" -# fi -# sleep 3 -# done -#echo "OK - Blockchain is synced" -#echo "" +# verify that chainnetwork is ready +chainIsReady=0 +while [ ${chainIsReady} -eq 0 ] + do + echo "*** Test if chaninnetwork is ready ..." + result=$(${network}-cli getblockchaininfo 2>error.out) + error=`cat error.out` + rm error.out + echo "result(${result})" + echo "error(${error})" + if [ ${#error} -gt 0 ]; then + sudo tail -n 5 /mnt/hdd/bitcoin/debug.log + echo "Waiting 1 minute and then trying again ..." + sleep 60 + echo "" + else + echo "OK - chainnetwork is working" + chainIsReady=1 + break + fi + done ###### LND Config echo "*** LND Config ***"