random string fix

This commit is contained in:
aniketfuryrocks 2023-03-17 10:18:23 +05:30
parent 3b0a64f199
commit a7b43bbcd6
No known key found for this signature in database
GPG Key ID: FA6BFCFAA7D4B764
2 changed files with 8 additions and 3 deletions

View File

@ -15,5 +15,5 @@ clap = { version = "4.1.6", features = ["derive"] }
tokio = { version = "1.25.0", features = ["full", "fs"]}
tracing-subscriber = "0.3.16"
dirs = "4.0.0"
uuid = { version = "1.3.0", features = ["v4"] }
rand = "0.8.5"

View File

@ -1,6 +1,7 @@
use std::str::FromStr;
use anyhow::Context;
use rand::{distributions::Alphanumeric, prelude::Distribution};
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::{
commitment_config::CommitmentConfig,
@ -68,9 +69,13 @@ impl BenchHelper {
funded_payer: &Keypair,
blockhash: Hash,
) -> Vec<Transaction> {
let random_bytes: Vec<u8> = Alphanumeric
.sample_iter(rand::thread_rng())
.take(10)
.collect();
(0..num_of_txs)
.into_iter()
.map(|_| Self::create_memo_tx(uuid::Uuid::new_v4().as_bytes(), funded_payer, blockhash))
.map(|_| Self::create_memo_tx(&random_bytes, funded_payer, blockhash))
.collect()
}