How do I send transaction which only valid for next X blocks, instead of default 150 blocks / ~ 1 minute (https://solana.com/docs/core/transactions#recent-blockhash).I need the transaction to fail fast, I need X to be in small number, i.e : 10-20 blocks instead of full 150 blocks.
const { lastValidBlockHeight, blockhash } = await connection.getLatestBlockhash({ commitment: "confirmed" }); const messageV0 = new TransactionMessage({ payerKey: payer, recentBlockhash: blockhash, instructions, }).compileToV0Message(); // how do i get the value here which only valid for next X blocks ? const transaction = new VersionedTransaction(messageV0); transaction.sign([payerKey]); const signature = await connection.sendTransaction(transaction); // wait 1 minute await connection.confirmTransaction( { blockhash: blockhash, lastValidBlockHeight: lastValidBlockHeight, signature: signature, },"confirmed" );