getHealth: return latestLedgerCloseTime in response#797
Draft
felixl256 wants to merge 2 commits into
Draft
Conversation
0585ad8 to
fcf6eb6
Compare
This was referenced Jun 19, 2026
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.
fcf6eb6 to
d3715bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #798
What
Populates the new
latestLedgerCloseTimefield on thegetHealthresponse with the close time (unix seconds) of the latest ingested ledger.Why
Lets clients read the chain tip's close time from the lightweight
getHealthprobe. Previously the only way to obtain a ledger's close time wasgetLatestLedger, which always returns the fullheaderXdr+metadataXdrof 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
LatestLedgerCloseTimetoGetHealthResponse.This PR is intentionally kept as a draft until that SDK change is merged and released:
go.modis left unchanged for now and will be bumped to the releasedgo-stellar-sdkversion (dropping any localreplace) before this is marked ready for review.Additive, backward-compatible change.