mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-10 04:43:10 +02:00
clean corrupted pre-sync blockchain
This commit is contained in:
@@ -69,12 +69,23 @@ fi
|
|||||||
if [ "${state}" = "presync" ]; then
|
if [ "${state}" = "presync" ]; then
|
||||||
# stopping the pre-sync
|
# stopping the pre-sync
|
||||||
echo ""
|
echo ""
|
||||||
echo "********************************************"
|
# analyse if blockchain was detected broken by pre-sync
|
||||||
echo "Stopping pre-sync ... pls wait (up to 1min)"
|
blockchainBroken=$(sudo tail /mnt/hdd/bitcoin/debug.log | grep -c "Please restart with -reindex or -reindex-chainstate to recover.")
|
||||||
echo "********************************************"
|
if [ ${blockchainBroken} -eq 1 ]; then
|
||||||
sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf stop
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "bitcoind called to stop .."
|
echo "Detected corrupted blockchain on pre-sync !"
|
||||||
sleep 50
|
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
|
# unmount the temporary mount
|
||||||
echo "Unmount HDD .."
|
echo "Unmount HDD .."
|
||||||
|
@@ -245,6 +245,8 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
|||||||
# check if pre-sync was already activated on last power-on
|
# check if pre-sync was already activated on last power-on
|
||||||
#presyncActive=$(systemctl status bitcoind | grep -c 'could not be found')
|
#presyncActive=$(systemctl status bitcoind | grep -c 'could not be found')
|
||||||
echo "starting pre-sync in background" >> $logFile
|
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
|
# starting in background, because this scripts is part of systemd
|
||||||
# so to change systemd needs to happen after delay in seperate process
|
# so to change systemd needs to happen after delay in seperate process
|
||||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin 2>> $logFile
|
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin 2>> $logFile
|
||||||
|
Reference in New Issue
Block a user