Skip to content

Commit

Permalink
RustClient: propagate error in chain data fetcher instead of panicking (
Browse files Browse the repository at this point in the history
  • Loading branch information
farnyser authored Apr 25, 2024
1 parent ed715ce commit e4098b4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/client/src/chain_data_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@ impl crate::AccountFetcher for AccountFetcher {
keys: &[Pubkey],
) -> anyhow::Result<Vec<(Pubkey, AccountSharedData)>> {
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::<Vec<_>>())
.map(|pk| chain_data.account(pk).map(|x| (*pk, x.account.clone())))
.collect::<anyhow::Result<Vec<_>>>();
result
}

async fn get_slot(&self) -> anyhow::Result<u64> {
Expand Down

0 comments on commit e4098b4

Please sign in to comment.