Hi @tiamo
A blockhash expires after 150 blocks (about 1 minute assuming 400ms block times), after which the transaction cannot be processed.
Sure, but the problem is that the canister cannot even see the response of getLatestBlockhash
since there will be a consensus error. There are basically 2 solutions that I see:
- Use durable transactions, but this requires setting up a nonce account.
- Hacky way:
- retrieve current
slot
, round that number to artificially increase the block time and avoid consensus errors. - Retrieve the block for that slot with
getBlock
, which containsblockhash
. That hash will not be super fresh (due to HTTPs outcall latency) but should be fresh enough to send a transaction for example.
- retrieve current
- Can I test this locally without deploying to mainnet?
Deser errors should be visible locally, but certain pitfalls of HTTPs outcalls (IPv6 + consensus) are only visible on mainnet. For this reason I would strongly encourage you to test on mainnet.