Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrug committed Feb 18, 2025
1 parent baeeed7 commit 77bdeec
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions crates/orderbook/src/database/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl OrderStoring for Postgres {

let mut ex = self.pool.acquire().await?;

let order = match orders::single_full_order_with_quote(&mut ex, &ByteArray(uid.0)).await? {
match orders::single_full_order_with_quote(&mut ex, &ByteArray(uid.0)).await? {
Some(order_with_quote) => {
let quote = match (
order_with_quote.quote_buy_amount,
Expand Down Expand Up @@ -352,22 +352,19 @@ impl OrderStoring for Postgres {
_ => None,
};

let order = full_order_with_quote_into_model_order(
Some(full_order_with_quote_into_model_order(
order_with_quote.full_order,
quote.as_ref(),
)?;
Some(order)
))
}
None => {
// try to find the order in the JIT orders table
database::jit_orders::get_by_id(&mut ex, &ByteArray(uid.0))
.await?
.map(full_order_into_model_order)
.transpose()?
}
};

Ok(order)
}
.transpose()
}

async fn orders_for_tx(&self, tx_hash: &H256) -> Result<Vec<Order>> {
Expand Down

0 comments on commit 77bdeec

Please sign in to comment.