fix: query Horizon inside the container and flag lost core connection

- Fetch Horizon via curl inside the container (127.0.0.1:8000) instead of
  the host port 31401; the host->bridge forwarding hung until the 5 s
  timeout and made each cycle take ~6 s instead of ~1 s
- Report an error when Horizon's core_latest_ledger is 0 (no connection
  to stellar-core) instead of a false "Synced" with a negative lag
- Compute the ingest lag against stellar-core's own ledger
- "History Oldest" now shows history_elder_ledger; the latest ledger is
  listed separately as "History Latest"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 08:05:10 +00:00
parent 4e27efc3b9
commit 6bca2c62e6
2 changed files with 25 additions and 12 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ Single self-contained script (`pi-stat`). Logic is split into helper functions a
- **Docker SDK** — container CPU/RAM stats; all commands run inside the auto-detected container (`mainnet` → `testnet2` → `testnet`, first running one) via `exec_run`
- **Stellar Core HTTP API** — `exec_json()` runs `stellar-core http-command <cmd>` inside the container
- **Horizon API** — `http://localhost:31401`
- **Horizon API** — `curl http://127.0.0.1:8000/` run inside the container via `exec_json()`, not via the host port `31401` (host→bridge forwarding can hang until timeout if Docker's host firewall rules are broken)
- **PostgreSQL** — `psql` inside the container; used for peer DB counts and pubkey→IP mapping
- **ZFS CLI** — `zpool`/`zfs` commands on the host for disk health (`z01pool`); if `zpool` is not found (`HAS_ZFS = False`), falls back to `shutil.disk_usage()` — works on Linux without ZFS, WSL2, and Windows
- **ip-api.com** — batch geolocation (Country, City), cached in `_geo_cache`; only fetched with `-g`