Skip to content

Adopt XDR views: Use GetLedgerRaw in rpcdatastore + metaToChunk #949

Open

Description

@cjonas9

Parent: #732

Note: this is the lowest-priority item in this epic because datastore-based requests aren't as common as database-based requests. If it ends up being low-hanging fruit towards the end of this epic, then it can be worked on.

Summary

Every getLedgers request that hits the datastore (history queries beyond local DB retention) pays the decode + re-encode cycle today. Use XDR views/GetLedgerRaw in rpcdatastore to avoid the needless work.

Scope

Files: cmd/stellar-rpc/internal/rpcdatastore/ledger_reader.go, cmd/stellar-rpc/internal/methods/get_ledgers.go, cmd/stellar-rpc/internal/methods/mocks.go

  • rpcdatastore.LedgerReader.GetLedgers returns [][]byte and stops calling GetLedger
  • metaToChunk uses view to slice the header bytes without re-marshaling
  • update mocks

Acceptance criteria

Requests hitting the RPC datastore should no longer undergo a wasted decode + encode.

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions