I am getting an error message when creating a signature
Error:
TransactionExpiredBlockheightExceededError: Signature 2XqzFuyv5YWpDPTT87CVu48QJPemGSu5rbCazrNBgY6D3mS8rugKugtzXDGpN6XZF8FPyWwXQvzfm4ZyMx6gTf6j has expired: block height exceeded.
Signature created like this:
const transaction = program.methods(...)
transaction.feePayer = publicKey;
transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
const latestBlockHash = await connection.getLatestBlockhash()
// ----> Phantom recommended way of signing tx
const { signature } = await provider.signAndSendTransaction(transaction);
const confirmation = await connection.confirmTransaction(
{
blockhash: latestBlockHash.blockhash,
lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
signature,
}
);
After few seconds/minute or 2 I get the above error message although the TX is confirmed and finalized.
How to handle this? Why is the error popping up if the tx gets added to the block?