From 9cb5dddeb7c954af32a0a34f60d8fc19ce8e878d Mon Sep 17 00:00:00 2001 From: imabdulbasit Date: Wed, 11 Oct 2023 23:47:30 +0500 Subject: [PATCH] no retry if blockhash not found --- consumer/src/solana.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/consumer/src/solana.rs b/consumer/src/solana.rs index 518778b..04b41ac 100644 --- a/consumer/src/solana.rs +++ b/consumer/src/solana.rs @@ -28,6 +28,7 @@ use mpl_token_metadata::{ use solana_client::{ client_error::{ClientError, ClientErrorKind}, rpc_client::RpcClient as SolanaRpcClient, + rpc_request::RpcError, }; use solana_program::{ instruction::Instruction, program_pack::Pack, pubkey::Pubkey, @@ -270,12 +271,12 @@ impl Solana { }; let signature = with_retry!(self.rpc().send_transaction(&transaction)) - .when(|e| { - !matches!( - e.kind, - ClientErrorKind::TransactionError(_) | ClientErrorKind::SigningError(_) - ) - }) + .when(|e| { + matches!(e.kind, ClientErrorKind::TransactionError(_) | ClientErrorKind::SigningError(_)| ClientErrorKind::RpcError(RpcError::RpcResponseError { + data: solana_client::rpc_request::RpcResponseErrorData::SendTransactionPreflightFailure(_), + .. + })) + }) .call() .map_err(|e| { let msg = format!("failed to send transaction: {e}");