From a1bf7a8f94e2d64006d5ab35167534b4ed851829 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Wed, 1 May 2019 03:15:48 +0200 Subject: [PATCH] #557 ignore reindex on future date --- home.admin/00raspiblitz.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/home.admin/00raspiblitz.sh b/home.admin/00raspiblitz.sh index 96948ae..82df7fa 100755 --- a/home.admin/00raspiblitz.sh +++ b/home.admin/00raspiblitz.sh @@ -80,6 +80,13 @@ if [ "${state}" = "presync" ]; then echo "" # analyse if blockchain was detected broken by pre-sync blockchainBroken=$(sudo tail /mnt/hdd/bitcoin/debug.log | grep -c "Please restart with -reindex or -reindex-chainstate to recover.") + # dismiss if its just a date thing + futureBlock=$(sudo tail /mnt/hdd/bitcoin/debug.log | grep "Please restart with -reindex or -reindex-chainstate to recover." | grep -c "block database contains a block which appears to be from the future") + if [ ${futureBlock} -gt 0 ]; then + blockchainBroken=0 + echo "-> Ignore reindex - its just a future block, but delete logs to avoid future mismatches" + sudo rm /mnt/hdd/bitcoin/debug.log + fi if [ ${blockchainBroken} -eq 1 ]; then echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "Detected corrupted blockchain on pre-sync !" @@ -164,6 +171,13 @@ waitUntilChainNetworkIsReady() # analyse LOGS for possible reindex reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover') + # dismiss if its just a date thing + futureBlock=$(sudo tail /mnt/hdd/${network}/debug.log | grep "Please restart with -reindex or -reindex-chainstate to recover" | grep -c "block database contains a block which appears to be from the future") + if [ ${futureBlock} -gt 0 ]; then + blockchainBroken=0 + echo "-> Ignore reindex - its just a future block, but delete logs to avoid future mismatches" + sudo rm /mnt/hdd/${network}/debug.log + fi if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options." sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info