Browse Source

added loop at invoice creation waiting for ldn to sync

dev
Raumi 6 years ago
parent
commit
4dc2de5644
  1. 23
      home.admin/BBcreateInvoice.sh

23
home.admin/BBcreateInvoice.sh

@ -17,16 +17,19 @@ echo ""
echo "*** Precheck ***"
# check if chain is in sync
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
if [ ${chainInSync} -eq 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
echo "Wait until chain is sync with LND and try again."
echo "!!!!!!!!!!!!!!!!!!!"
echo ""
exit 1
# TODO: Wait and loop. Offer the user a "abort wait" button
fi
cmdChainInSync="lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c"
chainInSync=$(cmdChainInSync)
while [ ${chainInSync} -eq 0 ]; do
dialog --title "Fail: not in sync" \
--ok-label "Try now" \
--cancel-label "Give up" \
--pause "\n\n'lncli getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
if [ $? -gt 0 ]; then
exit 1
fi
chainInSync=$(cmdChainInSync)
done
# check number of connected peers
echo "check for open channels"

Loading…
Cancel
Save