Skip to content

Commit

Permalink
dex: canonicalize trading pairs when converting from pb
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Jun 27, 2023
1 parent 006603c commit 5f577e5
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions crates/core/component/dex/src/trading_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,7 @@ impl TryFrom<pb::TradingPair> for TradingPair {
.ok_or_else(|| anyhow::anyhow!("missing trading pair asset2"))?
.try_into()?;
let trading_pair = TradingPair::new(asset_1, asset_2);
let result = Self { asset_1, asset_2 };
if trading_pair != result {
return Err(anyhow::anyhow!("non-canonical trading pair"));
}
Ok(result)
Ok(trading_pair)
}
}

Expand Down

0 comments on commit 5f577e5

Please sign in to comment.