From e15e0a8f83c3ad3dd3cc64f4abfe2db54368b5a5 Mon Sep 17 00:00:00 2001 From: Eric <92196970+ericlee42@users.noreply.github.com> Date: Tue, 16 Aug 2022 11:46:41 +0800 Subject: [PATCH] geth init always --- geth.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/geth.sh b/geth.sh index 198064f..b6b7b11 100755 --- a/geth.sh +++ b/geth.sh @@ -2,7 +2,7 @@ set -eou RETRIES=${RETRIES:-40} -VERBOSITY=${VERBOSITY:-6} +VERBOSITY=${VERBOSITY:-3} if [ -z "$DATADIR" ]; then echo "Must pass DATADIR" @@ -29,15 +29,14 @@ fi # If it exists, assume it's correct and skip geth init step GETH_CHAINDATA_DIR=$DATADIR/geth/chaindata -if [ -d "$GETH_CHAINDATA_DIR" ]; then - echo "$GETH_CHAINDATA_DIR existing, skipping geth init" -else - echo "$GETH_CHAINDATA_DIR missing, running geth init" - echo "Retrieving genesis file $L2GETH_GENESIS_URL" - TEMP_DIR=$(mktemp -d) - wget -O "$TEMP_DIR"/genesis.json "$L2GETH_GENESIS_URL" - geth init --datadir=/"$DATADIR" "$TEMP_DIR"/genesis.json -fi +echo "$GETH_CHAINDATA_DIR missing, running geth init" +echo "Retrieving genesis file $L2GETH_GENESIS_URL" +TEMP_DIR=$(mktemp -d) +wget -O "$TEMP_DIR"/genesis.json "$L2GETH_GENESIS_URL" +geth init --datadir=/"$DATADIR" "$TEMP_DIR"/genesis.json + +# Delete temp dir +rm -rf $TEMP_DIR # Check for an existing keystore folder. # If it exists, assume it's correct and skip geth acount import step