Rpc: add getBlockhashLastValidSlot endpoint #10237
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
It can be crucial for clients to know if a particular blockhash has expired.
getFeeCalculatorForBlockhash
offers one way to test this, but it would be a lot easier to know the expiration slot concretely.re: #10054 (comment)
Summary of Changes
getBlockhashLastValidSlot
rpc endpoint, and expose inRpcClient::get_recent_blockhash_with_commitment
I've left application of blockhash_last_valid_slot in various solana client crates, like solana-tokens, solana-bench-tps, or solana-cli
ping
, for separate prs. In particular, solana-bench-tps would require exposing blockhash_last_valid_slot in ThinClient (perhaps via the Client trait), and so deserves additional consideration.Incidentally, another approach could be to return the last-valid-slot with every
getRecentBlockhash
query, but it requires a lot more churn and very careful rollout, as there's a lot of potential to break downstream clients.Closes #10162