From eace323d5c10db8f28446ea0b69acc22671acde5 Mon Sep 17 00:00:00 2001 From: arkanoider <113362043+arkanoider@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:43:30 +0200 Subject: [PATCH] Simple idea for cancel take (#331) * idea for cancel take * fix cancel command for sell order * fix typo * removed wrong part of old PR --- src/app/cancel.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/cancel.rs b/src/app/cancel.rs index fdb3c817..d6b63279 100644 --- a/src/app/cancel.rs +++ b/src/app/cancel.rs @@ -29,6 +29,7 @@ pub async fn cancel_action( return Ok(()); } }; + if order.status == Status::Pending.to_string() { let user_pubkey = event.pubkey.to_string(); // Validates if this user is the order creator @@ -54,7 +55,8 @@ pub async fn cancel_action( } if order.kind == OrderKind::Sell.to_string() - && order.status == Status::WaitingBuyerInvoice.to_string() + && (order.status == Status::WaitingBuyerInvoice.to_string() + || order.status == Status::WaitingBuyerInvoice.to_string()) { cancel_add_invoice(ln_client, &mut order, event, pool, my_keys).await?; } @@ -162,8 +164,6 @@ pub async fn cancel_add_invoice( if let Some(hash) = &order.hash { ln_client.cancel_hold_invoice(hash).await?; info!("Order Id {}: Funds returned to seller", &order.id); - } else { - return Err(Error::msg("No hash present")); } let user_pubkey = event.pubkey.to_string();