mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-04 12:05:04 +02:00
clean corrupted pre-sync blockchain
This commit is contained in:
@@ -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 .."
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user