From deccc880d397172eeb352f248315992e5ee5aac0 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Fri, 17 Jun 2022 15:57:56 -0600 Subject: [PATCH] Nitty code simplification (#26038) --- cli/src/cluster_query.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index b5b28c5551..e1779717cf 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -1797,21 +1797,14 @@ pub fn process_show_stakes( if let Some(withdraw_authority_pubkey) = withdraw_authority_pubkey { // withdrawer filter - let withdrawer_filter = vec![rpc_filter::RpcFilterType::Memcmp(rpc_filter::Memcmp { + let withdrawer_filter = rpc_filter::RpcFilterType::Memcmp(rpc_filter::Memcmp { offset: 44, bytes: rpc_filter::MemcmpEncodedBytes::Base58(withdraw_authority_pubkey.to_string()), encoding: Some(rpc_filter::MemcmpEncoding::Binary), - })]; + }); - match program_accounts_config.filters { - Some(filters) => { - // filter by withdrawer - program_accounts_config.filters = Some([filters, withdrawer_filter].concat()) - } - None => { - program_accounts_config.filters = Some(withdrawer_filter); - } - } + let filters = program_accounts_config.filters.get_or_insert(vec![]); + filters.push(withdrawer_filter); } let all_stake_accounts = rpc_client