Client: Fix liq health accounts: no duplicate perp markets

This commit is contained in:
Christian Kamm 2022-12-09 16:16:14 +01:00
parent fe9c92e7ef
commit d3db44e7ba
1 changed files with 10 additions and 6 deletions

View File

@ -293,14 +293,18 @@ impl MangoGroupContext {
.active_serum3_orders() .active_serum3_orders()
.chain(account1.active_serum3_orders()) .chain(account1.active_serum3_orders())
.map(|&s| s.open_orders); .map(|&s| s.open_orders);
let perp_markets = account2 let perp_market_indexes = account2
.active_perp_positions() .active_perp_positions()
.chain(account1.active_perp_positions()) .chain(account1.active_perp_positions())
.map(|&pa| self.perp_market_address(pa.market_index)); .map(|&pa| pa.market_index)
let perp_oracles = account2 .unique()
.active_perp_positions() .collect::<Vec<_>>();
.chain(account1.active_perp_positions()) let perp_markets = perp_market_indexes
.map(|&pa| self.perp(pa.market_index).market.oracle); .iter()
.map(|&index| self.perp_market_address(index));
let perp_oracles = perp_market_indexes
.iter()
.map(|&index| self.perp(index).market.oracle);
let to_account_meta = |pubkey| AccountMeta { let to_account_meta = |pubkey| AccountMeta {
pubkey, pubkey,