Skip to content

Commit

Permalink
v1.18: RPC sendTransaction: be more liberal in determining and settin…
Browse files Browse the repository at this point in the history
…g 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 65a24d5)

Co-authored-by: Tyera <tyera@anza.xyz>
  • Loading branch information
mergify[bot] and CriesofCarrots authored Apr 18, 2024
1 parent 2444794 commit d7eb8f9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3602,8 +3602,11 @@ pub mod rpc_full {
let (wire_transaction, unsanitized_tx) =
decode_and_deserialize::<VersionedTransaction>(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,
Expand All @@ -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
Expand Down

0 comments on commit d7eb8f9

Please sign in to comment.