Add --no-multi-client (#6624)
This commit is contained in:
		@@ -21,6 +21,7 @@ pub struct Config {
 | 
				
			|||||||
    pub write_to_client_file: bool,
 | 
					    pub write_to_client_file: bool,
 | 
				
			||||||
    pub read_from_client_file: bool,
 | 
					    pub read_from_client_file: bool,
 | 
				
			||||||
    pub target_lamports_per_signature: u64,
 | 
					    pub target_lamports_per_signature: u64,
 | 
				
			||||||
 | 
					    pub multi_client: bool,
 | 
				
			||||||
    pub use_move: bool,
 | 
					    pub use_move: bool,
 | 
				
			||||||
    pub num_lamports_per_account: u64,
 | 
					    pub num_lamports_per_account: u64,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -41,6 +42,7 @@ impl Default for Config {
 | 
				
			|||||||
            write_to_client_file: false,
 | 
					            write_to_client_file: false,
 | 
				
			||||||
            read_from_client_file: false,
 | 
					            read_from_client_file: false,
 | 
				
			||||||
            target_lamports_per_signature: FeeCalculator::default().target_lamports_per_signature,
 | 
					            target_lamports_per_signature: FeeCalculator::default().target_lamports_per_signature,
 | 
				
			||||||
 | 
					            multi_client: true,
 | 
				
			||||||
            use_move: false,
 | 
					            use_move: false,
 | 
				
			||||||
            num_lamports_per_account: NUM_LAMPORTS_PER_ACCOUNT_DEFAULT,
 | 
					            num_lamports_per_account: NUM_LAMPORTS_PER_ACCOUNT_DEFAULT,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -108,6 +110,11 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
 | 
				
			|||||||
                .long("use-move")
 | 
					                .long("use-move")
 | 
				
			||||||
                .help("Use Move language transactions to perform transfers."),
 | 
					                .help("Use Move language transactions to perform transfers."),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        .arg(
 | 
				
			||||||
 | 
					            Arg::with_name("no-multi-client")
 | 
				
			||||||
 | 
					                .long("no-multi-client")
 | 
				
			||||||
 | 
					                .help("Disable multi-client support, only transact with the entrypoint."),
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        .arg(
 | 
					        .arg(
 | 
				
			||||||
            Arg::with_name("tx_count")
 | 
					            Arg::with_name("tx_count")
 | 
				
			||||||
                .long("tx_count")
 | 
					                .long("tx_count")
 | 
				
			||||||
@@ -229,6 +236,7 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    args.use_move = matches.is_present("use-move");
 | 
					    args.use_move = matches.is_present("use-move");
 | 
				
			||||||
 | 
					    args.multi_client = !matches.is_present("no-multi-client");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if let Some(v) = matches.value_of("num_lamports_per_account") {
 | 
					    if let Some(v) = matches.value_of("num_lamports_per_account") {
 | 
				
			||||||
        args.num_lamports_per_account = v.to_string().parse().expect("can't parse lamports");
 | 
					        args.num_lamports_per_account = v.to_string().parse().expect("can't parse lamports");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
use log::*;
 | 
					use log::*;
 | 
				
			||||||
use solana_bench_tps::bench::{do_bench_tps, generate_and_fund_keypairs, generate_keypairs};
 | 
					use solana_bench_tps::bench::{do_bench_tps, generate_and_fund_keypairs, generate_keypairs};
 | 
				
			||||||
use solana_bench_tps::cli;
 | 
					use solana_bench_tps::cli;
 | 
				
			||||||
use solana_core::gossip_service::{discover_cluster, get_multi_client};
 | 
					use solana_core::gossip_service::{discover_cluster, get_client, get_multi_client};
 | 
				
			||||||
use solana_genesis::Base64Account;
 | 
					use solana_genesis::Base64Account;
 | 
				
			||||||
use solana_sdk::fee_calculator::FeeCalculator;
 | 
					use solana_sdk::fee_calculator::FeeCalculator;
 | 
				
			||||||
use solana_sdk::signature::{Keypair, KeypairUtil};
 | 
					use solana_sdk::signature::{Keypair, KeypairUtil};
 | 
				
			||||||
@@ -29,6 +29,7 @@ fn main() {
 | 
				
			|||||||
        read_from_client_file,
 | 
					        read_from_client_file,
 | 
				
			||||||
        target_lamports_per_signature,
 | 
					        target_lamports_per_signature,
 | 
				
			||||||
        use_move,
 | 
					        use_move,
 | 
				
			||||||
 | 
					        multi_client,
 | 
				
			||||||
        num_lamports_per_account,
 | 
					        num_lamports_per_account,
 | 
				
			||||||
        ..
 | 
					        ..
 | 
				
			||||||
    } = &cli_config;
 | 
					    } = &cli_config;
 | 
				
			||||||
@@ -70,15 +71,19 @@ fn main() {
 | 
				
			|||||||
            exit(1);
 | 
					            exit(1);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let (client, num_clients) = get_multi_client(&nodes);
 | 
					    let client = if *multi_client {
 | 
				
			||||||
 | 
					        let (client, num_clients) = get_multi_client(&nodes);
 | 
				
			||||||
    if nodes.len() < num_clients {
 | 
					        if nodes.len() < num_clients {
 | 
				
			||||||
        eprintln!(
 | 
					            eprintln!(
 | 
				
			||||||
            "Error: Insufficient nodes discovered.  Expecting {} or more",
 | 
					                "Error: Insufficient nodes discovered.  Expecting {} or more",
 | 
				
			||||||
            num_nodes
 | 
					                num_nodes
 | 
				
			||||||
        );
 | 
					            );
 | 
				
			||||||
        exit(1);
 | 
					            exit(1);
 | 
				
			||||||
    }
 | 
					        }
 | 
				
			||||||
 | 
					        client
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        get_client(&nodes)
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let (keypairs, move_keypairs, keypair_balance) = if *read_from_client_file && !use_move {
 | 
					    let (keypairs, move_keypairs, keypair_balance) = if *read_from_client_file && !use_move {
 | 
				
			||||||
        let path = Path::new(&client_ids_and_stake_file);
 | 
					        let path = Path::new(&client_ids_and_stake_file);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user