Dogfood public bootstrap peers as secondary reinject seed.

Add bootstrap-peers.sh and fall back to stakesquid.eu/bootstrap when local peerset capture is empty; optional --seed-bootstrap on connect-peers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
rob
2026-07-19 08:56:52 +00:00
parent 6a19dc91e1
commit 9c6a4ab148
3 changed files with 176 additions and 7 deletions

View File

@@ -9,6 +9,11 @@
# target-compose-file: Optional. If provided, use this compose file for target node
# If not provided, use the same compose file for both source and target
#
# Secondary seed (optional): --seed-bootstrap pulls third-party enodes from the
# public bootstrap API (https://stakesquid.eu/bootstrap/<network>.json) into the
# source node after the pairwise connect — same JSON customers use; own peerset
# remains primary via peer-reinject.sh / peer-capture.
#
# Exit codes:
# 0 - At least one node connected successfully (bidirectional or one-way)
# 1 - Failed to connect to both nodes (see output for details)
@@ -65,6 +70,7 @@ fi
TIMEOUT=5
DRY_RUN=false
SEED_BOOTSTRAP=false
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -76,6 +82,10 @@ while [[ $# -gt 0 ]]; do
DRY_RUN=true
shift
;;
--seed-bootstrap)
SEED_BOOTSTRAP=true
shift
;;
*)
echo "Unknown option: $1"
usage
@@ -600,6 +610,30 @@ fi
echo -e "${CYAN}--- Summary ---${NC}"
echo ""
# Optional secondary seed from public bootstrap list (after pairwise connect).
if [[ "$SEED_BOOTSTRAP" == true ]]; then
echo -e "${CYAN}--- Bootstrap secondary seed ---${NC}"
if [[ -x "$BASEPATH/bootstrap-peers.sh" ]]; then
if [[ "$DRY_RUN" == true ]]; then
"$BASEPATH/bootstrap-peers.sh" --from-compose "$COMPOSE_FILE" --dry-run || true
else
mapfile -t BOOT_ENODES < <("$BASEPATH/bootstrap-peers.sh" --from-compose "$COMPOSE_FILE" 2>/dev/null | grep -E '^enode://' | head -n 25 || true)
BOOT_OK=0
for be in "${BOOT_ENODES[@]:-}"; do
[[ -z "$be" ]] && continue
RESULT=$(add_static_peer "$SOURCE_URL" "$be" "$SOURCE_CLIENT")
if check_rpc_success "$RESULT"; then
BOOT_OK=$((BOOT_OK + 1))
fi
done
echo -e " Added ${GREEN}${BOOT_OK}${NC}/${#BOOT_ENODES[@]} bootstrap enodes to source"
fi
else
echo -e "${YELLOW}bootstrap-peers.sh not found — skip${NC}"
fi
echo ""
fi
if [[ "$DRY_RUN" == true ]]; then
echo -e "${GREEN}Dry run completed - no changes made${NC}"
echo ""