From 1999138e124e47332985f0ff543bd37c34ddce81 Mon Sep 17 00:00:00 2001 From: galactus <96341601+godmodegalactus@users.noreply.github.com> Date: Thu, 17 Aug 2023 02:02:34 +0200 Subject: [PATCH] Using new method to deploy the programs (#32638) Using new method to deploy the programs, making blockheight comparison similar to previous implementation. --- cli/src/program.rs | 36 +++++++++++++------ ...nd_and_confirm_transactions_in_parallel.rs | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/cli/src/program.rs b/cli/src/program.rs index 6b366ce03bf8c8..a9acce30f83957 100644 --- a/cli/src/program.rs +++ b/cli/src/program.rs @@ -21,6 +21,9 @@ use { }, solana_client::{ connection_cache::ConnectionCache, + send_and_confirm_transactions_in_parallel::{ + send_and_confirm_transactions_in_parallel_blocking, SendAndConfrimConfig, + }, tpu_client::{TpuClient, TpuClientConfig}, }, solana_program_runtime::{compute_budget::ComputeBudget, invoke_context::InvokeContext}, @@ -2178,16 +2181,29 @@ fn send_deploy_messages( write_messages, &[payer_signer, write_signer], ), - ConnectionCache::Quic(cache) => TpuClient::new_with_connection_cache( - rpc_client.clone(), - &config.websocket_url, - TpuClientConfig::default(), - cache, - )? - .send_and_confirm_messages_with_spinner( - write_messages, - &[payer_signer, write_signer], - ), + ConnectionCache::Quic(cache) => { + let tpu_client_fut = solana_client::nonblocking::tpu_client::TpuClient::new_with_connection_cache( + rpc_client.get_inner_client().clone(), + config.websocket_url.as_str(), + solana_client::tpu_client::TpuClientConfig::default(), + cache, + ); + let tpu_client = rpc_client + .runtime() + .block_on(tpu_client_fut) + .expect("Should return a valid tpu client"); + + send_and_confirm_transactions_in_parallel_blocking( + rpc_client.clone(), + Some(tpu_client), + write_messages, + &[payer_signer, write_signer], + SendAndConfrimConfig { + resign_txs_count: Some(5), + with_spinner: true, + }, + ) + }, } .map_err(|err| format!("Data writes to account failed: {err}"))? .into_iter() diff --git a/client/src/send_and_confirm_transactions_in_parallel.rs b/client/src/send_and_confirm_transactions_in_parallel.rs index 50d42f3888416f..bab0cc6054f45e 100644 --- a/client/src/send_and_confirm_transactions_in_parallel.rs +++ b/client/src/send_and_confirm_transactions_in_parallel.rs @@ -286,7 +286,7 @@ async fn confirm_transactions_till_block_height_and_resend_unexpired_transaction // wait till all transactions are confirmed or we have surpassed max processing age for the last sent transaction while !unconfirmed_transasction_map.is_empty() - && current_block_height.load(Ordering::Relaxed) < max_valid_block_height + && current_block_height.load(Ordering::Relaxed) <= max_valid_block_height { let blockheight = current_block_height.load(Ordering::Relaxed);