Skip to content

protocols/rpc: Add LatestLedgerCloseTime to GetHealthResponse#5958

Open
felixl256 wants to merge 1 commit into
stellar:mainfrom
felixl256:protocols-rpc-health-close-time
Open

protocols/rpc: Add LatestLedgerCloseTime to GetHealthResponse#5958
felixl256 wants to merge 1 commit into
stellar:mainfrom
felixl256:protocols-rpc-health-close-time

Conversation

@felixl256

Copy link
Copy Markdown
PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex. services/friendbot, or all or doc if the changes are broad or impact many packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes. (N/A — this is a data-only struct field; behavior is exercised in stellar/stellar-rpc.)
  • I've updated any docs affected by this change (godoc on the new field).

Release planning

  • I've reviewed the changes in this PR and updated the relevant CHANGELOG.md.
  • I've decided this is a non-breaking, additive change (minor), targeted at main.

What

Adds a LatestLedgerCloseTime field (unix timestamp, in seconds) to protocols/rpc.GetHealthResponse.

Why

The RPC getHealth method already returns latestLedger, but not the time at which that ledger closed. Consumers that want to assess ledger freshness from the lightweight health endpoint currently have to additionally call getLatestLedger, which always returns the full headerXdr + metadataXdr of the ledger (multiple MB on active ledgers) — far too heavy for a health/monitoring probe.

The close time is the natural companion to latestLedger. Naming and format mirror the existing top-level latestLedgerCloseTime field already present in GetLedgersResponse (plain int64 unix seconds).

Server-side population is added in a follow-up PR in stellar/stellar-rpc.

Known limitations

N/A — additive, backward-compatible field (existing clients ignore the new field).

Copilot AI review requested due to automatic review settings June 19, 2026 05:08
@felixl256 felixl256 force-pushed the protocols-rpc-health-close-time branch from b0b0b72 to e090348 Compare June 19, 2026 05:08
@felixl256

Copy link
Copy Markdown
Author

Server-side consumer (populates the field on the getHealth handler): stellar/stellar-rpc#797

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an additional timestamp field to the RPC protocol type for getHealth, allowing consumers to determine ledger freshness without calling heavier endpoints.

Changes:

  • Extend protocols/rpc.GetHealthResponse with LatestLedgerCloseTime (unix seconds) and add godoc.
  • Add a Pending changelog entry describing the new response field.

Reviewed changes

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

File Description
protocols/rpc/get_health.go Adds LatestLedgerCloseTime to the getHealth response struct.
CHANGELOG.md Documents the new GetHealthResponse field under Pending features.

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

Comment thread protocols/rpc/get_health.go
Comment thread CHANGELOG.md Outdated
@felixl256

Copy link
Copy Markdown
Author

Tracking issue: stellar/stellar-rpc#798

Expose the latest ledger's close time (unix seconds) on the getHealth
response. The value is already available to the RPC server; surfacing it
lets clients assess ledger freshness from the lightweight health endpoint
without fetching full ledger metadata via getLatestLedger.
@felixl256 felixl256 force-pushed the protocols-rpc-health-close-time branch from bf8dc71 to 8c1d885 Compare June 19, 2026 08:55
felixl256 added a commit to felixl256/stellar-rpc that referenced this pull request Jun 19, 2026
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.
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.

2 participants