From 651e739c1e2be81e104319c25c84da8206ad74ac Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 27 Apr 2024 02:34:30 +0800 Subject: [PATCH] v1.18: cli: use newer blockhashes when deploying large programs (backport of #1070) (#1074) --- ...end_and_confirm_transactions_in_parallel.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/src/send_and_confirm_transactions_in_parallel.rs b/client/src/send_and_confirm_transactions_in_parallel.rs index b9ec1ef08b8355..9c764efd34d848 100644 --- a/client/src/send_and_confirm_transactions_in_parallel.rs +++ b/client/src/send_and_confirm_transactions_in_parallel.rs @@ -261,16 +261,18 @@ async fn sign_all_messages_and_send( // send all the transaction messages for (counter, (index, message)) in messages_with_index.iter().enumerate() { let mut transaction = Transaction::new_unsigned(message.clone()); - let blockhashdata = *context.blockhash_data_rw.read().await; - - // we have already checked if all transactions are signable. - transaction - .try_sign(signers, blockhashdata.blockhash) - .expect("Transaction should be signable"); - let serialized_transaction = serialize(&transaction).expect("Transaction should serialize"); - let signature = transaction.signatures[0]; futures.push(async move { tokio::time::sleep(SEND_INTERVAL.saturating_mul(counter as u32)).await; + let blockhashdata = *context.blockhash_data_rw.read().await; + + // we have already checked if all transactions are signable. + transaction + .try_sign(signers, blockhashdata.blockhash) + .expect("Transaction should be signable"); + let serialized_transaction = + serialize(&transaction).expect("Transaction should serialize"); + let signature = transaction.signatures[0]; + // send to confirm the transaction context.unconfirmed_transaction_map.insert( signature,