get_program_accounts_with_config() now correctly defaults to RpcClient's commitment level

This commit is contained in:
Michael Vines
2021-05-18 11:11:38 -07:00
committed by mergify[bot]
parent cfcae50022
commit 63b97729e6

View File

@ -1166,7 +1166,6 @@ impl RpcClient {
filters: None, filters: None,
account_config: RpcAccountInfoConfig { account_config: RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64Zstd), encoding: Some(UiAccountEncoding::Base64Zstd),
commitment: Some(self.commitment_config),
..RpcAccountInfoConfig::default() ..RpcAccountInfoConfig::default()
}, },
}, },
@ -1178,7 +1177,10 @@ impl RpcClient {
pubkey: &Pubkey, pubkey: &Pubkey,
config: RpcProgramAccountsConfig, config: RpcProgramAccountsConfig,
) -> ClientResult<Vec<(Pubkey, Account)>> { ) -> ClientResult<Vec<(Pubkey, Account)>> {
let commitment = config.account_config.commitment.unwrap_or_default(); let commitment = config
.account_config
.commitment
.unwrap_or_else(|| self.commitment());
let commitment = self.maybe_map_commitment(commitment)?; let commitment = self.maybe_map_commitment(commitment)?;
let account_config = RpcAccountInfoConfig { let account_config = RpcAccountInfoConfig {
commitment: Some(commitment), commitment: Some(commitment),