Skip to content

Conversation

@Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Feb 10, 2026

Closes #598.

Why not error? Well there's no reason to, really. Returning an empty page with a valid cursor that would effectively perform the same request is a better UX.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a panic in the getLedgers RPC method when the queried ledger slice is empty (e.g., due to a race between cached latest ledger and the read transaction snapshot), aiming to return an empty page with a usable cursor instead of failing the request.

Changes:

  • Adds a length check before indexing into the ledgers slice when deriving the response cursor.
  • Introduces a fallback cursor value when no ledgers are returned.

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

@Shaptic
Copy link
Contributor Author

Shaptic commented Feb 10, 2026

@copilot review it again pls

Copy link

Copilot AI commented Feb 10, 2026

@Shaptic I've opened a new pull request, #600, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


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

@Shaptic Shaptic enabled auto-merge (squash) February 11, 2026 17:11
@Shaptic Shaptic merged commit 299a274 into main Feb 11, 2026
39 of 40 checks passed
@Shaptic Shaptic deleted the defensive-ledger-check branch February 11, 2026 17:34
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.

getLedgers: Add bounds check for empty ledger result

4 participants