From d7eb8f91c41c69190d4560837df122cc1aaec696 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:20:02 -0600 Subject: [PATCH] v1.18: RPC sendTransaction: be more liberal in determining and setting last_valid_block_height for skip_preflight case (backport of #483) (#873) RPC sendTransaction: be more liberal in determining and setting last_valid_block_height for skip_preflight case (#483) * RPC sendTransaction: if skip_preflight, use processed-commitment Bank for last_valid_block_height and sanitization * Use nonce retry logic for skip_preflight transactions if blockhash was not found (cherry picked from commit 65a24d5140a8805bd9b837820d8049166d2f6f38) Co-authored-by: Tyera --- rpc/src/rpc.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index 59484817ad06c6..9b892ade4d7766 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -3602,8 +3602,11 @@ pub mod rpc_full { let (wire_transaction, unsanitized_tx) = decode_and_deserialize::(data, binary_encoding)?; - let preflight_commitment = - preflight_commitment.map(|commitment| CommitmentConfig { commitment }); + let preflight_commitment = if skip_preflight { + Some(CommitmentConfig::processed()) + } else { + preflight_commitment.map(|commitment| CommitmentConfig { commitment }) + }; let preflight_bank = &*meta.get_bank_with_config(RpcContextConfig { commitment: preflight_commitment, min_context_slot, @@ -3619,7 +3622,7 @@ pub mod rpc_full { let durable_nonce_info = transaction .get_durable_nonce() .map(|&pubkey| (pubkey, *transaction.message().recent_blockhash())); - if durable_nonce_info.is_some() { + if durable_nonce_info.is_some() || (skip_preflight && last_valid_block_height == 0) { // While it uses a defined constant, this last_valid_block_height value is chosen arbitrarily. // It provides a fallback timeout for durable-nonce transaction retries in case of // malicious packing of the retry queue. Durable-nonce transactions are otherwise