fix: use admin_addPeer for op-geth peer reconciliation

op-geth does not support admin_addStaticPeer; classify op-geth via
compose path (admin_nodeInfo often still says Geth) and fall back on
go-ethereum-style "does not exist/is not available" errors so reinject
and connect-peers restore peers (e.g. hashkey-mainnet).
This commit is contained in:
2026-07-30 11:58:12 +00:00
parent 4806a8ad1b
commit a7135129eb
3 changed files with 37 additions and 15 deletions

View File

@@ -78,16 +78,21 @@ CLIENT_NAME="$(echo "$INFO" | jq -r '.result.name // empty' 2>/dev/null || true)
PEERS_JSON="$(rpc admin_peers)"
PEER_COUNT="$(echo "$PEERS_JSON" | jq -r '.result | length' 2>/dev/null || echo 0)"
# Detect client type (connect-peers.sh logic)
# Detect client type (connect-peers.sh logic).
# op-geth often still reports as "Geth/…" — prefer compose path for op-geth.
NAME_LC="$(echo "$CLIENT_NAME" | tr '[:upper:]' '[:lower:]')"
CLIENT_TYPE="unknown"
case "$NAME_LC" in
*op-geth*) CLIENT_TYPE="op-geth" ;;
*geth*) CLIENT_TYPE="geth" ;;
*reth*) CLIENT_TYPE="reth" ;;
*erigon*) CLIENT_TYPE="erigon" ;;
*nethermind*) CLIENT_TYPE="nethermind" ;;
*besu*) CLIENT_TYPE="besu" ;;
esac
case "$COMPOSE_PATH" in
*op-geth*) CLIENT_TYPE="op-geth" ;;
esac
TS="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "$PEERS_JSON" | jq -c --arg path "$COMPOSE_PATH" --arg ts "$TS" \