Skip to content

Commit

Permalink
return an error when we get no p2p response for best_orders
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocynicys committed Dec 6, 2024
1 parent c406aa2 commit 2a1cff4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mm2src/mm2_main/src/lp_ordermatch/best_orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ pub async fn best_orders_rpc(ctx: MmArc, req: Json) -> Result<Response<Vec<u8>>,
response.entry(coin.clone()).or_insert_with(Vec::new).push(entry);
}
}
} else {
return Err("No response from any peer".to_string());
}

let res = json!({ "result": response, "original_tickers": &ordermatch_ctx.original_tickers });
Expand Down Expand Up @@ -388,6 +390,8 @@ pub async fn best_orders_rpc_v2(
orders.entry(coin.clone()).or_insert_with(Vec::new).push(entry);
}
}
} else {
return MmError::err(BestOrdersRpcError::P2PError("No response from any peer".to_string()));
}

Ok(BestOrdersV2Response {
Expand Down

0 comments on commit 2a1cff4

Please sign in to comment.