From 4d777bacd006e428f05927815517c654f2313cbf Mon Sep 17 00:00:00 2001 From: arkanoider <113362043+arkanoider@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:49:15 +0200 Subject: [PATCH] fix for issue #320 (#321) * fix for issue #320 * fix: prevents the creation of an order with inverted min & max amounts (#322) --------- Co-authored-by: Bilthon --- src/app/order.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/order.rs b/src/app/order.rs index 1354a3a2..2d3b651b 100644 --- a/src/app/order.rs +++ b/src/app/order.rs @@ -38,6 +38,11 @@ pub async fn order_action( // Get max and and min amount in case of range order // in case of single order do like usual if let (Some(min), Some(max)) = (order.min_amount, order.max_amount) { + if min >= max { + let msg = format!("Min amount is greater than max amount"); + send_cant_do_msg(order.id, Some(msg), &event.pubkey).await; + return Ok(()); + } if order.amount == 0 { amount_vec.clear(); amount_vec.push(min);