Skip to content

feat(indexer): enrich ledger_metadata with real ledger hash#22

Open
Depo-dev wants to merge 1 commit into
devfrom
feat/issue-8-get-ledger-enrichment
Open

feat(indexer): enrich ledger_metadata with real ledger hash#22
Depo-dev wants to merge 1 commit into
devfrom
feat/issue-8-get-ledger-enrichment

Conversation

@Depo-dev

@Depo-dev Depo-dev commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds RpcClient::get_ledger(sequence: u64) calling the Stellar getLedgers JSON-RPC method with limit: 1
  • Called once per unique ledger sequence at the end of each poll batch
  • Failure is non-fatal: logs a warning and falls back to empty string so the poll cycle is never blocked by a bad RPC enrichment call

Changes

  • crates/indexer/src/rpc/mod.rs — adds get_ledger(), GetLedgersParams, LedgerSummary types
  • crates/indexer/src/streamer/mod.rs — calls get_ledger after cursor advance, stores real hash in ledger_metadata

Test plan

  • Run indexer against testnet; confirm ledger_metadata.ledger_hash is non-empty after a poll cycle
  • Kill the RPC endpoint mid-run; confirm indexer continues with a warning log, not a crash

Closes #8

Adds RpcClient::get_ledger(sequence) which calls the Stellar getLedgers
JSON-RPC method (limit=1) to retrieve the real ledger hash. Called once
per unique ledger sequence after each poll batch. Failure is non-fatal:
logs a warning and stores an empty string so the poll cycle continues.

Closes #8

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant