Browse Source

Activating RESYNC in RepairOptions

v1.3
Christian Rotzoll 6 years ago
parent
commit
ed008bb0bc
  1. 44
      home.admin/00raspiblitz.sh
  2. 1
      home.admin/10setupBlitz.sh
  3. 23
      home.admin/50syncHDD.sh
  4. 11
      home.admin/98repairBlockchain.sh
  5. 13
      home.admin/XXcleanHDD.sh

44
home.admin/00raspiblitz.sh

@ -171,10 +171,17 @@ waitUntilChainNetworkIsReady()
blockchainsize=$(sudo du -shbc /mnt/hdd/${network} 2>/dev/null | head -n1 | awk '{print $1;}')
if [ ${#blockchainsize} -gt 0 ]; then
if [ ${blockchainsize} -lt ${minSize} ]; then
echo "blockchainsize(${blockchainsize})"
echo "Missing Blockchain Data (<${minSize}) ..."
clienterror="missing blockchain"
sleep 3
if [ "${state}" != "resync" ]; then
echo "blockchainsize(${blockchainsize})"
echo "Missing Blockchain Data (<${minSize}) ..."
clienterror="missing blockchain"
sleep 3
else
echo "RE-SYNC is running"
/home/admin/80scanLND.sh
sleep 10
exit 0;
fi
fi
fi
@ -196,20 +203,27 @@ waitUntilChainNetworkIsReady()
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
sleep 3
dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired.
whiptail --title "RaspiBlitz - Repair Script" --yes-button "DELETE+REPAIR" --no-button "Ignore" --yesno "Your blockchain data needs to be repaired.
This can be due to power problems or a failing HDD.
Please check the FAQ on RaspiBlitz Github
'My blockchain data is corrupted - what can I do?'
https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md
For more info see: https://raspiblitz.com -> FAQ
The RaspiBlitz will now try to help you on with the repair.
To run a BACKUP of funds & channels first is recommended.
" 13 65
Before RaspiBlitz can offer you repair options the old
corrupted blockchain needs to be deleted while your LND
funds and channel stay safe (just expect some off-time).
clear
/home/admin/98repairBlockchain.sh
/home/admin/00raspiblitz.sh
exit
How do you want to continue?
" 13 65
if [ $? -eq 0 ]; then
#delete+repair
clear
/home/admin/XXcleanHDD.sh -blockchain -force
/home/admin/98repairBlockchain.sh
/home/admin/00raspiblitz.sh
exit
else
# ignore - just delete blockchain logfile
clear
fi
fi

1
home.admin/10setupBlitz.sh

@ -220,6 +220,7 @@ if [ ${mountOK} -eq 1 ]; then
;;
S)
/home/admin/50syncHDD.sh
/home/admin/10setupBlitz.sh
;;
esac
exit 1

23
home.admin/50syncHDD.sh

@ -35,8 +35,8 @@ if [ "$network" = "bitcoin" ]; then
response=$?
case $response in
0) echo "--> OK";;
1) ./10setupBlitz.sh; exit 1;;
255) ./10setupBlitz.sh; exit 1;;
1) exit 1;;
255) exit 1;;
esac
clear
@ -57,11 +57,20 @@ if [ "$network" = "bitcoin" ]; then
fi
echo "*** Activating Blockain Sync ***"
sudo mkdir /mnt/hdd/${network}
sudo mkdir /mnt/hdd/${network} 2>/dev/null
echo "OK - sync is activated"
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
if [ "${setupStep}" = "100" ]; then
# continue setup
./60finishHDD.sh
# set so that 10raspiblitz.sh has a flag to see that resync is running
sudo sed -i "s/^state=.*/state=resync/g" $infoFile
else
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# continue setup
./60finishHDD.sh
fi

11
home.admin/98repairBlockchain.sh

@ -1,10 +1,14 @@
#!/bin/bash
echo ""
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# Basic Options
OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \
COPY "Copy from another Computer (SKILLED)" \
REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \
RESYNC "Resync thru Peer2Peer Network (TRUSTLESS)" \
BACKUP "Run Backup LND data first (optional)"
)
@ -23,6 +27,11 @@ elif [ "${CHOICE}" = "COPY" ]; then
/home/admin/50copyHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
elif [ "${CHOICE}" = "RESYNC" ]; then
echo "Starting RESYNC ..."
/home/admin/50syncHDD.sh
/home/
elif [ "${CHOICE}" = "REINDEX" ]; then
echo "Starting REINDEX ..."
sudo /home/admin/config.scripts/network.reindex.sh

13
home.admin/XXcleanHDD.sh

@ -1,6 +1,7 @@
#!/bin/bash
echo ""
extraParameter="$1"
forceParameter="$2"
if [ "${extraParameter}" = "-all" ]; then
echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
@ -24,11 +25,13 @@ if [ "${extraParameter}" = "-all" ]; then
elif [ "${extraParameter}" = "-blockchain" ]; then
echo "This will DELETE JUST your blockchain from the HDD."
echo "--> It will keep your LND data and other setups."
echo "--> You will get presented re-download options."
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
read key
if [ "${forceParameter}" != "-force" ]; then
echo "This will DELETE JUST your blockchain from the HDD."
echo "--> It will keep your LND data and other setups."
echo "--> You will get presented re-download options."
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
read key
fi
echo "stopping services ... (please wait)"
echo "- swap"

Loading…
Cancel
Save