This commit is contained in:
goldsquid
2025-09-04 20:35:07 +07:00
parent 0f0ff380dc
commit 07587e99d6

View File

@@ -16,6 +16,8 @@ if [ -n "$NO_SSL" ]; then
DOMAIN="${DOMAIN:-0.0.0.0}" DOMAIN="${DOMAIN:-0.0.0.0}"
fi fi
blocktag=${2:-latest}
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+") pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+")
for path in $pathlist; do for path in $pathlist; do
@@ -29,13 +31,13 @@ for path in $pathlist; do
if $include; then if $include; then
RPC_URL="${PROTO:-https}://$DOMAIN/$path" RPC_URL="${PROTO:-https}://$DOMAIN/$path"
if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["${blocktag}",false],"id":1}' | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then
exit 0 exit 0
else else
if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq; then if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["${blocktag}",false],"id":1}' | jq; then
exit 1 exit 1
else else
curl -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' curl -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["${blocktag}",false],"id":1}'
fi fi
fi fi
fi fi