Browse Source

clean corrupted pre-sync blockchain

dev
rootzoll 6 years ago
parent
commit
e0828ecddf
  1. 23
      home.admin/00mainMenu.sh
  2. 2
      home.admin/_bootstrap.sh

23
home.admin/00mainMenu.sh

@ -69,12 +69,23 @@ fi
if [ "${state}" = "presync" ]; then
# stopping the pre-sync
echo ""
echo "********************************************"
echo "Stopping pre-sync ... pls wait (up to 1min)"
echo "********************************************"
sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf stop
echo "bitcoind called to stop .."
sleep 50
# 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.")
if [ ${blockchainBroken} -eq 1 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Detected corrupted blockchain on pre-sync !"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Deleting blockchain data ..."
echo "(needs to get downloaded fresh during setup)"
sudo rm -f -r /mnt/hdd/bitcoin
else
echo "********************************************"
echo "Stopping pre-sync ... pls wait (up to 1min)"
echo "********************************************"
sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf stop
echo "bitcoind called to stop .."
sleep 50
fi
# unmount the temporary mount
echo "Unmount HDD .."

2
home.admin/_bootstrap.sh

@ -245,6 +245,8 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
# check if pre-sync was already activated on last power-on
#presyncActive=$(systemctl status bitcoind | grep -c 'could not be found')
echo "starting pre-sync in background" >> $logFile
# make sure that debug file is clean, so just pre-sync gets analysed on stop
sudo rm /mnt/hdd/bitcoin/debug.log
# starting in background, because this scripts is part of systemd
# so to change systemd needs to happen after delay in seperate process
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin 2>> $logFile

Loading…
Cancel
Save