From 9f83c3b1f73a30bfbf2756b56bb6a8ceb2cbecbf Mon Sep 17 00:00:00 2001 From: Serge Farny Date: Thu, 25 Apr 2024 13:32:30 +0200 Subject: [PATCH] RustClient: propagate error in chain data fetcher instead of panicking --- lib/client/src/chain_data_fetcher.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/client/src/chain_data_fetcher.rs b/lib/client/src/chain_data_fetcher.rs index 2fe9313c9f..bc4b096a99 100644 --- a/lib/client/src/chain_data_fetcher.rs +++ b/lib/client/src/chain_data_fetcher.rs @@ -248,10 +248,11 @@ impl crate::AccountFetcher for AccountFetcher { keys: &[Pubkey], ) -> anyhow::Result> { let chain_data = self.chain_data.read().unwrap(); - Ok(keys + let result = keys .iter() - .map(|pk| (*pk, chain_data.account(pk).unwrap().account.clone())) - .collect::>()) + .map(|pk| chain_data.account(pk).map(|x| (*pk, x.account.clone()))) + .collect::>>(); + result } async fn get_slot(&self) -> anyhow::Result {