bitcoin: production-ready mainnet bitcoind for DRPC serving
Switch to bitcoin/bitcoin:31.0 with txindex and tuned RPC flags, drop the esplora indexer sidecar, and add bitcoin-protocol health probes so fleet status and wait-for-online work for bitcoin-family nodes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,11 +10,12 @@ fi
|
||||
RPC_URL=$1
|
||||
shift
|
||||
|
||||
# Check for --starknet / --aztec / --cosmos / --ripple flag
|
||||
# Check for --starknet / --aztec / --cosmos / --ripple / --bitcoin flag
|
||||
is_starknet=false
|
||||
is_aztec=false
|
||||
is_cosmos=false
|
||||
is_ripple=false
|
||||
is_bitcoin=false
|
||||
if [ "$1" == "--starknet" ]; then
|
||||
is_starknet=true
|
||||
shift
|
||||
@@ -27,6 +28,9 @@ elif [ "$1" == "--cosmos" ]; then
|
||||
elif [ "$1" == "--ripple" ]; then
|
||||
is_ripple=true
|
||||
shift
|
||||
elif [ "$1" == "--bitcoin" ]; then
|
||||
is_bitcoin=true
|
||||
shift
|
||||
fi
|
||||
|
||||
REF=""
|
||||
@@ -102,6 +106,34 @@ if $is_ripple; then
|
||||
echo "online"; exit 0
|
||||
fi
|
||||
|
||||
# Bitcoin-family (bitcoind/dogecoind): getblockchaininfo — initialblockdownload=true means syncing.
|
||||
# Short-circuits here; the EVM/starknet/aztec block-comparison path below is not used.
|
||||
if $is_bitcoin; then
|
||||
status=$(curl -L --ipv4 -m $timeout -s -u username:password -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"1.0","id":1,"method":"getblockchaininfo","params":[]}' "$RPC_URL")
|
||||
if [ $? -ne 0 ] || [ -z "$status" ]; then echo "error"; exit 1; fi
|
||||
ibd=$(echo "$status" | jq -r '.result.initialblockdownload' 2>/dev/null)
|
||||
node_height=$(echo "$status" | jq -r '.result.blocks' 2>/dev/null)
|
||||
if [ -z "$node_height" ] || [ "$node_height" = "null" ]; then echo "error"; exit 1; fi
|
||||
if [ "$ibd" = "true" ]; then echo "syncing"; exit 1; fi
|
||||
if [ -n "$ref" ]; then
|
||||
ref_status=$($BASEPATH/multicurl.sh -L --ipv4 -m $timeout -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"1.0","id":1,"method":"getblockcount","params":[]}' $ref)
|
||||
ref_height=$(echo "$ref_status" | jq -r '.result' 2>/dev/null)
|
||||
if [ -n "$ref_height" ] && [ "$ref_height" != "null" ] && [ "$ref_height" -gt 0 ] 2>/dev/null; then
|
||||
lag=$(( ref_height - node_height ))
|
||||
lo=${LAGGING_LAG:-2}; hi=${SYNCING_LAG:-6}
|
||||
if [ "$lo" -gt "$hi" ]; then tmp=$lo; lo=$hi; hi=$tmp; fi
|
||||
if [ "$lag" -le "$lo" ]; then
|
||||
echo "online"; exit 0
|
||||
elif [ "$lag" -le "$hi" ]; then
|
||||
echo "lagging"; exit 0
|
||||
else
|
||||
echo "syncing"; exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "online"; exit 0
|
||||
fi
|
||||
|
||||
response_file=$(mktemp)
|
||||
|
||||
# Use appropriate RPC method based on chain type
|
||||
|
||||
Reference in New Issue
Block a user