Browse Source

detect missing blockchain data

v1.1
Christian Rotzoll 6 years ago
parent
commit
b91b148ea8
  1. 15
      home.admin/00mainMenu.sh
  2. 6
      home.admin/50copyHDD.sh

15
home.admin/00mainMenu.sh

@ -134,14 +134,27 @@ waitUntilChainNetworkIsReady()
echo "can take longer if device was off or first time"
while :
do
# check for error on network
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
clienterror=`cat error.tmp`
rm error.tmp
# check for missing blockchain data
blockchainsize=$(du /mnt/hdd/bitcoin | head -n1 | awk '{print $1;}')
if [ ${#blockchainsize} -gt 0 ]; then
if [ ${blockchainsize} -lt 1000000 ]; then
echo "Mission Bloclchain Data ..."
clienterror="missing blockchain"
sleep 3
fi
fi
if [ ${#clienterror} -gt 0 ]; then
# analyse LOGS for possible reindex
reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
if [ ${reindex} -gt 0 ]; then
if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
sleep 3

6
home.admin/50copyHDD.sh

@ -41,7 +41,10 @@ fi
# delete all IN bitcoin directory but not itself if it exists
# so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird
# also keep debug logs for repair script
sudo mv /mnt/hdd/bitcoin/debug.log /home/admin/debug.log 2>/dev/null
sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null
sudo mv /home/admin/debug.log /mnt/hdd/bitcoin/debug.log 2>/dev/null
# make sure /mnt/hdd/bitcoin exists
sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
@ -49,6 +52,7 @@ sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
# allow all users write to it
sudo chmod 777 /mnt/hdd/bitcoin
echo
clear
echo "************************************************************************************"
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another computer"
@ -125,7 +129,7 @@ if [ ${anyDataAtAll} -eq 1 ]; then
else
echo "OK -> DATA LOOKS GOOD :D"
sudo rm /mnt/hdd/${network}/debug.log
sudo rm /mnt/hdd/bitcoin/debug.log
fi

Loading…
Cancel
Save