detect scan height better

This commit is contained in:
rootzoll
2018-08-22 19:25:07 +02:00
parent c841efa9e3
commit c4c78d9180
2 changed files with 3 additions and 7 deletions

View File

@@ -171,12 +171,8 @@ else
ln_alias=$(echo "${ln_getInfo}" | grep "alias" | cut -d '"' -f4)
ln_sync=$(echo "${ln_getInfo}" | grep "synced_to_chain" | grep "true" -c)
if [ ${ln_sync} -eq 0 ]; then
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep height | tail -n1 | awk '{print $9} {print $10} {print $11} {print $12}' | tr -dc '0-9')
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep "(height" | tail -n1 | awk '{print $9} {print $10} {print $11} {print $12}' | tr -dc '0-9')
total=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.blocks')
checkItem=$(echo "${item}" | grep '000' -c)
if [ ${checkItem} -eq 0 ]; then
item="?"
fi
ln_baseInfo="${color_red} waiting for chain sync"
ln_channelInfo="${item}/${total}"
else

View File

@@ -7,9 +7,9 @@ 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')"
gotData=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c height)
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 $9} {print $10} {print $11} {print $12}' | tr -dc '0-9')
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep "(height" | tail -n1 | awk '{print $9} {print $10} {print $11} {print $12}' | tr -dc '0-9')
fi
# get total number of blocks