Make health iteration code work with pyth oracles

They have a different account owner, that error must be skipped.
This commit is contained in:
Christian Kamm 2022-05-26 20:38:03 +02:00 committed by tjs
parent 36729ad008
commit 84e9cbd030
2 changed files with 5 additions and 2 deletions

View File

@ -90,7 +90,8 @@ pub fn margin_trade<'key, 'accounts, 'remaining, 'info>(
allowed_banks.insert(ai.key, bank);
}
Err(Error::AnchorError(error))
if error.error_code_number == ErrorCode::AccountDiscriminatorMismatch as u32 =>
if error.error_code_number == ErrorCode::AccountDiscriminatorMismatch as u32
|| error.error_code_number == ErrorCode::AccountOwnedByWrongProgram as u32 =>
{
break;
}

View File

@ -114,7 +114,9 @@ impl<'a, 'b> ScanningAccountRetriever<'a, 'b> {
}
Err(Error::AnchorError(error))
if error.error_code_number
== ErrorCode::AccountDiscriminatorMismatch as u32 =>
== ErrorCode::AccountDiscriminatorMismatch as u32
|| error.error_code_number
== ErrorCode::AccountOwnedByWrongProgram as u32 =>
{
break;
}