Skip to content

Commit

Permalink
Using new method to deploy the programs (solana-labs#32638)
Browse files Browse the repository at this point in the history
Using new method to deploy the programs, making blockheight comparison similar to previous implementation.
  • Loading branch information
godmodegalactus authored Aug 17, 2023
1 parent a9ecdc0 commit 1999138
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
36 changes: 26 additions & 10 deletions cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion client/src/send_and_confirm_transactions_in_parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1999138

Please sign in to comment.