From 601a2ea28dc1f75d1b30b6a5c4ea77cb368dfa9e Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Fri, 3 Sep 2021 11:03:06 -0700 Subject: [PATCH] Add RpcClient::get_multiple_accounts_with_config() --- client/src/rpc_client.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index 98349fec88b632..3476c9ea0d89f3 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -2966,11 +2966,22 @@ impl RpcClient { pubkeys: &[Pubkey], commitment_config: CommitmentConfig, ) -> RpcResult>> { - let config = RpcAccountInfoConfig { - encoding: Some(UiAccountEncoding::Base64Zstd), - commitment: Some(self.maybe_map_commitment(commitment_config)?), - data_slice: None, - }; + self.get_multiple_accounts_with_config( + pubkeys, + RpcAccountInfoConfig { + encoding: Some(UiAccountEncoding::Base64Zstd), + commitment: Some(self.maybe_map_commitment(commitment_config)?), + data_slice: None, + }, + ) + } + + pub fn get_multiple_accounts_with_config( + &self, + pubkeys: &[Pubkey], + mut config: RpcAccountInfoConfig, + ) -> RpcResult>> { + config.commitment = config.commitment.or_else(|| Some(self.commitment())); let pubkeys: Vec<_> = pubkeys.iter().map(|pubkey| pubkey.to_string()).collect(); let response = self.send(RpcRequest::GetMultipleAccounts, json!([pubkeys, config]))?; let Response {