Skip to content

getHealth: return latestLedgerCloseTime in response#797

Draft
felixl256 wants to merge 2 commits into
stellar:mainfrom
felixl256:health-latest-ledger-close-time
Draft

getHealth: return latestLedgerCloseTime in response#797
felixl256 wants to merge 2 commits into
stellar:mainfrom
felixl256:health-latest-ledger-close-time

Conversation

@felixl256

@felixl256 felixl256 commented Jun 19, 2026

Copy link
Copy Markdown

Resolves #798

What

Populates the new latestLedgerCloseTime field on the getHealth response with the close time (unix seconds) of the latest ingested ledger.

Why

Lets clients read the chain tip's close time from the lightweight getHealth probe. Previously the only way to obtain a ledger's close time was getLatestLedger, which always returns the full headerXdr + metadataXdr of the ledger (multiple MB on active ledgers) — unsuitable for frequent health/monitoring polling.

The value (ledgerRange.LastLedger.CloseTime) is already loaded for the existing latency check, so there is no additional cost.

Known limitations

Depends on stellar/go-stellar-sdk#5958, which adds LatestLedgerCloseTime to GetHealthResponse.

This PR is intentionally kept as a draft until that SDK change is merged and released: go.mod is left unchanged for now and will be bumped to the released go-stellar-sdk version (dropping any local replace) before this is marked ready for review.

Additive, backward-compatible change.

Populate the new latestLedgerCloseTime field with the close time of the
latest ingested ledger. The value is already loaded for the existing
latency check, so there is no additional cost. Lets clients assess ledger
freshness from the lightweight health endpoint without fetching full
ledger metadata via getLatestLedger.

Depends on stellar/go-stellar-sdk adding the field to GetHealthResponse;
go.mod will be bumped to the released SDK version before this is merged.
The getHealth handler depends on LatestLedgerCloseTime, added in stellar/go-stellar-sdk#5958 (not yet released). Point the module at the fork commit so this builds; remove this replace and bump to the released SDK version before merging.
@felixl256 felixl256 force-pushed the health-latest-ledger-close-time branch from fcf6eb6 to d3715bc Compare June 19, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getHealth: expose latest ledger close time (latestLedgerCloseTime)

1 participant