From a7ba4d173f0bbd3512c10dd3a58baf4cbca7048e Mon Sep 17 00:00:00 2001 From: Kirill Lykov Date: Thu, 16 Feb 2023 22:16:07 +0100 Subject: [PATCH] simplified staked_nodes creation --- bench-tps/src/main.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index 9b2803dac4b752..562d3c90857b40 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -99,13 +99,11 @@ fn create_connection_cache( let (stake, total_stake) = find_node_activated_stake(rpc_client, client_node_id.pubkey()).unwrap_or_default(); info!("Stake for specified client_node_id: {stake}, total stake: {total_stake}"); - let staked_nodes = Arc::new(RwLock::new(StakedNodes::default())); - staked_nodes.write().unwrap().total_stake = total_stake; - staked_nodes - .write() - .unwrap() - .pubkey_stake_map - .insert(client_node_id.pubkey(), stake); + let staked_nodes = Arc::new(RwLock::new(StakedNodes { + total_stake, + pubkey_stake_map: HashMap::from([(client_node_id.pubkey(), stake)]), + ..StakedNodes::default() + })); ConnectionCache::new_with_client_options( tpu_connection_pool_size, None,