#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$ROOT_DIR/lecoffre_node" max_tries=${1:-60} sleep_secs=${2:-5} for i in $(seq 1 "$max_tries"); do # Get current scanned height from blindbit logs or api scanned="unknown" if out=$(docker compose logs --tail=200 blindbit | grep -oE 'successfully processed block.*height=\s*[0-9]+' | tail -n1 | grep -oE '[0-9]+$'); then scanned="$out" fi if docker compose exec -T blindbit sh -lc 'wget -q --spider http://127.0.0.1:8000/tweaks/1' >/dev/null 2>&1; then echo "BlindBit ready at scanned block ${scanned} (try $i)" exit 0 fi echo "Wait sync (blindbit), now scanned: ${scanned} (try $i)" sleep "$sleep_secs" done echo "Timeout waiting for BlindBit readiness" exit 1