A mistake sneaked in about the last valid block height (for tx validity). Slots are way ahead of blockHeights, as the blockHeight count doesn't increase when no block is produced during a slot.
Summary of Changes
lastValidBlockHeight should be used instead. Yet this one is confusing because it's current block height + 300, so we have to subtract 150 from it
alternatively we can get the current blockHeight (via getBlockHeight) then add 150 to it. But that's 2 rpc calls instead of 1.
PS: it'd be great to update the lastValidBlockHeight number returned from getLatestBlockhash such that it's just 150 ahead of getBlockHeight. I'm sure it's confusing more devs writing the tx retry logic of their apps.
Problem
A mistake sneaked in about the last valid block height (for tx validity). Slots are way ahead of blockHeights, as the blockHeight count doesn't increase when no block is produced during a slot.
Summary of Changes
lastValidBlockHeight
should be used instead. Yet this one is confusing because it's current block height + 300, so we have to subtract 150 from itgetBlockHeight
) then add 150 to it. But that's 2 rpc calls instead of 1.PS: it'd be great to update the
lastValidBlockHeight
number returned fromgetLatestBlockhash
such that it's just 150 ahead ofgetBlockHeight
. I'm sure it's confusing more devs writing the tx retry logic of their apps.