RustClient: propagate error in chain data fetcher instead of panicking (#952)
This commit is contained in:
parent
ed715ce855
commit
e4098b4550
|
@ -248,10 +248,11 @@ impl crate::AccountFetcher for AccountFetcher {
|
||||||
keys: &[Pubkey],
|
keys: &[Pubkey],
|
||||||
) -> anyhow::Result<Vec<(Pubkey, AccountSharedData)>> {
|
) -> anyhow::Result<Vec<(Pubkey, AccountSharedData)>> {
|
||||||
let chain_data = self.chain_data.read().unwrap();
|
let chain_data = self.chain_data.read().unwrap();
|
||||||
Ok(keys
|
let result = keys
|
||||||
.iter()
|
.iter()
|
||||||
.map(|pk| (*pk, chain_data.account(pk).unwrap().account.clone()))
|
.map(|pk| chain_data.account(pk).map(|x| (*pk, x.account.clone())))
|
||||||
.collect::<Vec<_>>())
|
.collect::<anyhow::Result<Vec<_>>>();
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_slot(&self) -> anyhow::Result<u64> {
|
async fn get_slot(&self) -> anyhow::Result<u64> {
|
||||||
|
|
Loading…
Reference in New Issue