From cdd8d913a4af434b343c83ef16f7203b3e779d03 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 26 Oct 2023 05:33:14 -0500 Subject: [PATCH] Skip nwc invoices that are in-flight --- mutiny-core/src/nostr/nwc.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mutiny-core/src/nostr/nwc.rs b/mutiny-core/src/nostr/nwc.rs index 13f656c4f..451822773 100644 --- a/mutiny-core/src/nostr/nwc.rs +++ b/mutiny-core/src/nostr/nwc.rs @@ -371,9 +371,12 @@ impl NostrWalletConnect { return Ok(None); } - // if we have already paid this invoice, skip it + // if we have already paid or are attempting to pay this invoice, skip it let node = node_manager.get_node(from_node).await?; - if node.get_invoice(&invoice).is_ok_and(|i| i.paid()) { + if node + .get_invoice(&invoice) + .is_ok_and(|i| matches!(i.status, HTLCStatus::Succeeded | HTLCStatus::InFlight)) + { return Ok(None); } drop(node);