Skip to content

Commit

Permalink
fix for issue #320
Browse files Browse the repository at this point in the history
  • Loading branch information
arkanoider committed Jul 4, 2024
1 parent 46a617d commit 4aa0ae6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/app/order.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::cli::settings::Settings;
use crate::lightning::invoice::decode_invoice;
use crate::util::{get_market_quote, publish_order, send_cant_do_msg};
use crate::util::{get_market_quote, publish_order, send_cant_do_msg, send_dm};

use anyhow::Result;
use mostro_core::message::Message;
use mostro_core::message::{Action, Message, MessageKind};
use nostr_sdk::{Event, Keys};
use sqlx::{Pool, Sqlite};
use tracing::error;
Expand Down Expand Up @@ -38,6 +38,17 @@ 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 message = MessageKind::new(
order.id,
Some(event.pubkey.to_string()),
Action::CantDo,
None,
);
if let Ok(message) = message.as_json() {
let _ = send_dm(&event.pubkey, message).await;
}
}
if order.amount == 0 {
amount_vec.clear();
amount_vec.push(min);
Expand Down

0 comments on commit 4aa0ae6

Please sign in to comment.