liquidator: don't panic when unable to build health cache

This commit is contained in:
Christian Kamm 2023-12-22 08:11:34 +01:00
parent 27b1ceebe8
commit cdf804e971
2 changed files with 3 additions and 3 deletions

View File

@ -158,7 +158,7 @@ impl<'a> LiquidateHelper<'a> {
let mut health_cache = let mut health_cache =
health_cache::new(&self.client.context, self.account_fetcher, &liqor) health_cache::new(&self.client.context, self.account_fetcher, &liqor)
.await .await
.expect("always ok"); .context("health cache")?;
let quote_bank = self let quote_bank = self
.client .client
.first_bank(QUOTE_TOKEN_INDEX) .first_bank(QUOTE_TOKEN_INDEX)

View File

@ -58,7 +58,7 @@ pub fn max_swap_source_with_limits(
let health_cache = let health_cache =
mango_v4_client::health_cache::new_sync(&client.context, account_fetcher, &account) mango_v4_client::health_cache::new_sync(&client.context, account_fetcher, &account)
.expect("always ok"); .context("health cache")?;
let source_bank: Bank = account_fetcher.fetch(&client.context.token(source).first_bank())?; let source_bank: Bank = account_fetcher.fetch(&client.context.token(source).first_bank())?;
let target_bank: Bank = account_fetcher.fetch(&client.context.token(target).first_bank())?; let target_bank: Bank = account_fetcher.fetch(&client.context.token(target).first_bank())?;
@ -100,7 +100,7 @@ pub fn max_swap_source_ignoring_limits(
let health_cache = let health_cache =
mango_v4_client::health_cache::new_sync(&client.context, account_fetcher, &account) mango_v4_client::health_cache::new_sync(&client.context, account_fetcher, &account)
.expect("always ok"); .context("health cache")?;
let source_bank: Bank = account_fetcher.fetch(&client.context.token(source).first_bank())?; let source_bank: Bank = account_fetcher.fetch(&client.context.token(source).first_bank())?;
let target_bank: Bank = account_fetcher.fetch(&client.context.token(target).first_bank())?; let target_bank: Bank = account_fetcher.fetch(&client.context.token(target).first_bank())?;