You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are correct that lastValidBlockHeight exists on Transaction, but that's actually an anti-pattern.
The thing is, the last block height for which a blockhash is valid is neither encoded in a transaction (it's nowhere in the bytes) nor is it even resolvable from a transaction (there's no call you can make to ask ‘until which blockheight is this blockhash valid?’). In short, it doesn't belong on transactions.
The lastValidBlockHeight is a property of you-having-fetched-the-blockhash. You should save it for use in transaction confirmation. If you obtained the blockhash from somewhere else, that somewhere else should also vend the lastValidBlockHeight. If neither of those is the case, and you're really desperate to know when the blockhash expires, you can fetch the SysvarRecentB1ockHashes11111111111111111111 account, figure out the position at which your blockhash sits, and infer how many blocks it has to go before it falls off the end.
Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.
Motivation
I want to prevent a versioned transaction from landing too late.
If I understand the docs correctly, this feature already exists on legacy transactions. It's the lastValidBlockHeight property.
Could we look into adding this to versioned transactions also? Thanks!
https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html
The text was updated successfully, but these errors were encountered: