From 72d324780ebea3f082dee6807e2ebb2d98c6d518 Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:55:17 +0100 Subject: [PATCH] fix(gui): Only refund swaps in the background that haven't been refunded yet (#212) --- swap/src/cli/watcher.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/swap/src/cli/watcher.rs b/swap/src/cli/watcher.rs index f75e92efa..b6fcf3a10 100644 --- a/swap/src/cli/watcher.rs +++ b/swap/src/cli/watcher.rs @@ -107,6 +107,11 @@ impl Watcher { // If the swap has to be refunded, do it in the background if let Some(ExpiredTimelocks::Cancel { .. }) = new_timelock_status { + // If the swap is already refunded, we can skip the refund + if matches!(state, BobState::BtcRefunded(_)) { + continue; + } + // If the swap is already running, we can skip the refund // The refund will be handled by the state machine if let Some(current_swap_id) = self.swap_lock.get_current_swap_id().await {