protocols/rpc: Add LedgerCloseTime to GetHealthResponse#5958
Conversation
b0b0b72 to
e090348
Compare
|
Server-side consumer (populates the field on the |
There was a problem hiding this comment.
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.GetHealthResponsewithLatestLedgerCloseTime(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.
|
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.
bf8dc71 to
8c1d885
Compare
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.
Shaptic
left a comment
There was a problem hiding this comment.
One blocking comment below ⬇️ otherwise a welcome addition!
…e to GetHealthResponse String-encode `LatestLedgerCloseTime` with `,string` for JavaScript 64-bit compatibility, matching the other RPC close-time fields. Add `OldestLedgerCloseTime` (unix seconds, also string-encoded) for parity with `OldestLedger`; the stellar-rpc getHealth handler populates it from the already-available oldest ledger close time. Update CHANGELOG and the rpcclient GetHealth round-trip test.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Drop the temporary fork replace (added in d3715bc) now that the getHealth close-time fields have merged upstream (stellar/go-stellar-sdk#5958). No tagged SDK release includes them yet, so require the post-merge main pseudo-version for now; bump to a tagged release once one is published.
Pulls in stellar/go-stellar-sdk#5958. fc9acb3f is the current SDK main tip; no tagged release includes it yet.
PR Checklist
PR Structure
services/friendbot, orallordocif the changes are broad or impact many packages.Thoroughness
Release planning
CHANGELOG.md.main.What
Adds a
LatestLedgerCloseTimefield (unix timestamp, in seconds) toprotocols/rpc.GetHealthResponse.Why
The RPC
getHealthmethod already returnslatestLedger, 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 callgetLatestLedger, which always returns the fullheaderXdr+metadataXdrof 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-levellatestLedgerCloseTimefield already present inGetLedgersResponse(plainint64unix 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).