Merge pull request #154 from blockworks-foundation/log_bench_tx_issues

log tx send errors
This commit is contained in:
Aniket Prajapati 2023-06-23 18:11:31 +05:30 committed by GitHub
commit e47676b8ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -6,7 +6,7 @@ use bench::{
use clap::Parser;
use dashmap::DashMap;
use futures::future::join_all;
use log::{error, info};
use log::{error, info, warn};
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::{
commitment_config::CommitmentConfig, hash::Hash, signature::Keypair, signer::Signer,
@ -169,15 +169,20 @@ async fn bench(
let blockhash = { *block_hash.read().await };
let tx = BenchHelper::create_memo_tx(&rand_string, &funded_payer, blockhash);
let start_time = Instant::now();
if let Ok(signature) = rpc_client.send_transaction(&tx).await {
map_of_txs.insert(
signature,
TxSendData {
sent_duration: start_time.elapsed(),
sent_instant: Instant::now(),
sent_slot: current_slot.load(std::sync::atomic::Ordering::Relaxed),
},
);
match rpc_client.send_transaction(&tx).await {
Ok(signature) => {
map_of_txs.insert(
signature,
TxSendData {
sent_duration: start_time.elapsed(),
sent_instant: Instant::now(),
sent_slot: current_slot.load(std::sync::atomic::Ordering::Relaxed),
},
);
}
Err(e) => {
warn!("tx send failed with error {}", e);
}
}
}
});