Reindex tweaks and improvements

-Added an "Are you sure" prompt before starting the reindex to make it clear that this is a destructive sync option
-All necessary coin stat data is cleared before starting the resync (txes, blockchain_last_updated and richlist_last_updated were not previously being cleared)
-More and better messages about what is being done during the process
-Shifted some of the code around to be run in a better order (for example, blockchain_last_updated date is set right after finishing the blockchain sync instead of at the very end of the reindex)
This commit is contained in:
Joe Uhren
2022-03-19 18:44:36 -06:00
parent 26a35700d4
commit cd05484ba5
2 changed files with 45 additions and 20 deletions
+13
View File
@@ -120,6 +120,19 @@ if [ -n "${MODE}" ]; then
# Check if the desired mode requires a lock
if [ "${MODE}" != "peers" ] && [ "${MODE}" != "masternodes" ]; then
# A lock is required
# Check if this is a reindex
if [ "${MODE}" = "index reindex" ]; then
# Prompt for the reindex
echo "You are about to delete all blockchain data (transactions and addresses)"
echo "and resync from the genesis block."
echo "Are you sure you want to do this? [y/n]: ";
read -p "" REINDEX_ANSWER
# Determine if the reindex should proceed
case "$REINDEX_ANSWER" in
y|Y|yes|Yes|YES) ;;
*) echo "Process aborted. Nothing was deleted." && exit ;;
esac
fi
# Check if the script is already running (tmp/index.pid file already exists)
if [ -f "${EXPLORER_PATH}/tmp/index.pid" ]; then
# The tmp/index.pid file exists. Check if the process is actually still running