Skip to content

Commit

Permalink
Merge pull request #154 from anacrolix/patch-1
Browse files Browse the repository at this point in the history
Update progress.sh
  • Loading branch information
Chomtana authored Jul 26, 2024
2 parents 2c8b6f9 + 615485d commit c276ee1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions progress.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
#!/bin/bash

set -eu

# Load Environment Variables
if [ -f .env ]; then
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
fi

export ETH_RPC_URL=http://localhost:${PORT__OP_GETH_HTTP:-9993}
# Cast is provided by Foundry: https://getfoundry.sh/.
# Run `pnpm install:foundry` in the optimism repo root.
CHAIN_ID=`cast chain-id`
echo Chain ID: $CHAIN_ID
echo Please wait
echo Sampling, please wait

if [ $CHAIN_ID -eq 10 ]; then
L2_URL=https://mainnet.optimism.io
fi


if [ $CHAIN_ID -eq 420 ]; then
L2_URL=https://goerli.optimism.io
fi


if [ $CHAIN_ID -eq 11155420 ]; then
L2_URL=https://sepolia.optimism.io
fi

T0=`cast block-number --rpc-url $ETH_RPC_URL` ; sleep 10 ; T1=`cast block-number --rpc-url $ETH_RPC_URL`
PER_MIN=`expr $T1 - $T0`
PER_MIN=`expr $PER_MIN \* 6`
PER_MIN=$(($T1 - $T0))
PER_MIN=$(($PER_MIN * 6))
echo Blocks per minute: $PER_MIN


if [ $PER_MIN -eq 0 ]; then
echo Not synching
echo Not syncing
exit;
fi

Expand Down

0 comments on commit c276ee1

Please sign in to comment.