Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

add option to send transfer to same account #24214

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ fn make_accounts_txs(
total_num_transactions: usize,
hash: Hash,
same_payer: bool,
same_write_account: bool,
) -> Vec<Transaction> {
let to_pubkey = solana_sdk::pubkey::new_rand();
let payer_key = Keypair::new();
Expand All @@ -82,7 +83,9 @@ fn make_accounts_txs(
if !same_payer {
new.message.account_keys[0] = solana_sdk::pubkey::new_rand();
}
new.message.account_keys[1] = solana_sdk::pubkey::new_rand();
if !same_write_account {
new.message.account_keys[1] = solana_sdk::pubkey::new_rand();
}
new.signatures = vec![Signature::new(&sig[0..64])];
new
})
Expand Down Expand Up @@ -138,6 +141,12 @@ fn main() {
.takes_value(false)
.help("Use the same payer for transfers"),
)
.arg(
Arg::with_name("same_write_account")
.long("same-write-account")
.takes_value(false)
.help("Use the destination account for transfers"),
)
.arg(
Arg::with_name("iterations")
.long("iterations")
Expand Down Expand Up @@ -183,8 +192,13 @@ fn main() {
info!("threads: {} txs: {}", num_threads, total_num_transactions);

let same_payer = matches.is_present("same_payer");
let mut transactions =
make_accounts_txs(total_num_transactions, genesis_config.hash(), same_payer);
let same_write_account = matches.is_present("same_write_account");
let mut transactions = make_accounts_txs(
total_num_transactions,
genesis_config.hash(),
same_payer,
same_write_account,
);

// fund all the accounts
transactions.iter().for_each(|tx| {
Expand Down