Allow thin clients to be passed across thread boundaries (#3887)
* Remove ThinClient wrapper * Allow RpcClient (and ThinClient) to be passed across thread boundaries * Pass clients, not constructors * Fix bad rebase
This commit is contained in:
@@ -8,7 +8,6 @@ use solana::cluster_info::FULLNODE_PORT_RANGE;
|
||||
use solana::contact_info::ContactInfo;
|
||||
use solana::gossip_service::discover_nodes;
|
||||
use solana_client::thin_client::create_client;
|
||||
use solana_client::thin_client::ThinClient;
|
||||
use solana_sdk::signature::KeypairUtil;
|
||||
|
||||
fn main() {
|
||||
@@ -35,7 +34,8 @@ fn main() {
|
||||
let nodes = discover_nodes(&network_addr, num_nodes).unwrap_or_else(|_| {
|
||||
panic!("Failed to discover nodes");
|
||||
});
|
||||
let client_ctors: Vec<_> = nodes
|
||||
|
||||
let clients: Vec<_> = nodes
|
||||
.iter()
|
||||
.filter_map(|node| {
|
||||
let cluster_entrypoint = node.clone();
|
||||
@@ -43,26 +43,24 @@ fn main() {
|
||||
if ContactInfo::is_valid_address(&cluster_addrs.0)
|
||||
&& ContactInfo::is_valid_address(&cluster_addrs.1)
|
||||
{
|
||||
let client_ctor =
|
||||
move || -> ThinClient { create_client(cluster_addrs, FULLNODE_PORT_RANGE) };
|
||||
Some(client_ctor)
|
||||
let client = create_client(cluster_addrs, FULLNODE_PORT_RANGE);
|
||||
Some(client)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
info!("{} nodes found", client_ctors.len());
|
||||
if client_ctors.len() < num_nodes {
|
||||
info!("{} nodes found", clients.len());
|
||||
if clients.len() < num_nodes {
|
||||
panic!("Error: Insufficient nodes discovered");
|
||||
}
|
||||
|
||||
info!("Funding keypair: {}", identity.pubkey());
|
||||
|
||||
let client = client_ctors[0]();
|
||||
let accounts_in_groups = batch_size * account_groups;
|
||||
airdrop_lamports(
|
||||
&client,
|
||||
&clients[0],
|
||||
&drone_addr,
|
||||
&identity,
|
||||
fund_amount * (accounts_in_groups + 1) as u64 * 2,
|
||||
@@ -78,5 +76,5 @@ fn main() {
|
||||
account_groups,
|
||||
};
|
||||
|
||||
do_bench_exchange(client_ctors, config);
|
||||
do_bench_exchange(clients, config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user