Browse Source

more info on blockchain sync up

#146
rootzoll 6 years ago
parent
commit
a5de027a15
  1. 16
      home.admin/80scanLND.sh

16
home.admin/80scanLND.sh

@ -9,14 +9,17 @@ localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1
# parse the actual scanned height progress from LND logs
item=0
chain="$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')"
blockchaininfo=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo)
chain="$(echo "${blockchaininfo}" | jq -r '.chain')"
gotData=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c "(height")
if [ ${gotData} -gt 0 ]; then
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep "(height" | tail -n1 | awk '{print $10} {print $11} {print $12}' | tr -dc '0-9')
fi
# get total number of blocks
total=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.blocks')
total=$(echo "${blockchaininfo}" | jq -r '.blocks')
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
# calculate progress in percent
percent=$(awk "BEGIN { pc=100*${item}/${total}; i=int(pc); print (pc-i<0.5)?i:i+1 }")
@ -29,10 +32,11 @@ fi
heigh=6
isWaitingBlockchain=$( sudo -u bitcoin tail -n 2 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep "Waiting for chain backend to finish sync" -c )
if [ ${isWaitingBlockchain} -gt 0 ]; then
infoStr=" Waiting for final Blockchain Sync\nplease wait - this can take some time\nssh admin@${localip}\nPassword A"
heigh=7
infoStr=" Waiting for final Blockchain Sync\n Progress: ${progress}\n please wait - this can take some time\n ssh admin@${localip}\n Password A"
if [ "$USER" = "admin" ]; then
heigh=5
infoStr=$(echo " Waiting for final Blockchain Sync\nplease wait - this can take some time\nIts OK to close terminal and ssh back in later.")
heigh=6
infoStr=$(echo " Waiting for final Blockchain Sync\n Progress: ${progress}\n please wait - this can take some time\n Its OK to close terminal and ssh back in later.")
fi
else
infoStr=$(echo " Lightning Rescanning Blockchain ${percent}%\n please wait - this can take some time\n ssh admin@${localip}\n Password A")
@ -43,5 +47,5 @@ else
fi
# display progress to user
sleep 1
sleep 3
dialog --title " ${network} / ${chain} " --backtitle "RaspiBlitz (${name})" --infobox "${infoStr}" ${heigh} 42
Loading…
Cancel
Save