Skip to content

getHealth: return LedgerCloseTime in response#797

Merged
Shaptic merged 5 commits into
stellar:mainfrom
felixl256:health-latest-ledger-close-time
Jun 25, 2026
Merged

getHealth: return LedgerCloseTime in response#797
Shaptic merged 5 commits into
stellar:mainfrom
felixl256:health-latest-ledger-close-time

Conversation

@felixl256

@felixl256 felixl256 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Resolves #798

What

Populates the new latestLedgerCloseTime and oldestLedgerCloseTime fields on the getHealth response with the close times (unix seconds) of the latest and oldest ingested ledgers.

Why

Lets clients read ledger close times 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.

Both values (ledgerRange.LastLedger.CloseTime / ledgerRange.FirstLedger.CloseTime) are already loaded for the existing latency check, so there is no additional cost. oldestLedgerCloseTime was added for parity with the existing latestLedger/oldestLedger pair (requested in review on the SDK PR).

SDK dependency

Depends on stellar/go-stellar-sdk#5958 (now merged), which adds both LatestLedgerCloseTime and OldestLedgerCloseTime to GetHealthResponse.

No tagged go-stellar-sdk release includes #5958 yet, so go.mod is bumped to the post-merge main pseudo-version (v0.6.1-0.20260624185910-fc9acb3f1ba6) and the temporary fork replace has been dropped. To be re-pinned to a tagged release once one is cut.

Additive, backward-compatible change.

@felixl256 felixl256 force-pushed the health-latest-ledger-close-time branch from 0585ad8 to fcf6eb6 Compare June 19, 2026 05:09
@felixl256 felixl256 force-pushed the health-latest-ledger-close-time branch from fcf6eb6 to d3715bc Compare June 19, 2026 09:01
@felixl256 felixl256 changed the title getHealth: return latestLedgerCloseTime in response getHealth: return LedgerCloseTime in response Jun 23, 2026
Comment thread go.mod Outdated
Pulls in stellar/go-stellar-sdk#5958. fc9acb3f is the current SDK main tip; no tagged release includes it yet.
…response

Expose the latest and oldest ledgers' close times (unix seconds) on the getHealth response, populated from the ledger range already available to the handler, so clients can gauge ledger freshness from the lightweight health endpoint.
@felixl256 felixl256 force-pushed the health-latest-ledger-close-time branch from cd63f57 to bb7b925 Compare June 25, 2026 05:38
@socket-security

socket-security Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​stellar/​go-stellar-sdk@​v0.6.1-0.20260618191317-308407eca8c6 ⏵ v0.6.1-0.20260624185910-fc9acb3f1ba675 +1100100100100

View full report

@felixl256 felixl256 marked this pull request as ready for review June 25, 2026 05:39
Copilot AI review requested due to automatic review settings June 25, 2026 05:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This draft PR updates the getHealth JSON-RPC handler to return ledger close time(s) alongside the existing ledger range fields, enabling clients to measure chain-tip freshness without calling the heavyweight getLatestLedger endpoint.

Changes:

  • Populate latestLedgerCloseTime (and also oldestLedgerCloseTime) in the getHealth response.
  • Extend the health integration test to assert close-time fields are present and monotonic.
  • Add an Unreleased changelog entry and bump github.com/stellar/go-stellar-sdk to a newer pseudo-version.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go.mod Bumps go-stellar-sdk dependency version.
go.sum Updates checksums for the bumped go-stellar-sdk version.
cmd/stellar-rpc/internal/methods/get_health.go Adds close-time fields to the GetHealthResponse struct literal.
cmd/stellar-rpc/internal/integrationtest/health_test.go Adds assertions for the new close-time fields.
CHANGELOG.md Documents new getHealth response fields under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/stellar-rpc/internal/methods/get_health.go
Comment thread go.mod
@felixl256 felixl256 requested a review from Shaptic June 25, 2026 06:11
@Shaptic Shaptic enabled auto-merge (squash) June 25, 2026 16:15
Comment thread cmd/stellar-rpc/internal/integrationtest/health_test.go Outdated
Comment thread cmd/stellar-rpc/internal/integrationtest/health_test.go Outdated
@Shaptic Shaptic merged commit 4b7986a into stellar:main Jun 25, 2026
16 of 17 checks passed
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 and oldest ledger close times

3 participants