From e1de1111f8f9e80c5d6fe51d5910c26de780f0cd Mon Sep 17 00:00:00 2001 From: f321x Date: Mon, 8 Sep 2025 17:07:03 +0200 Subject: [PATCH] swaps: only set swap redeemed if preimage is available For forward swaps this will ensure that the swap only gets set redeemed and cleaned up after the preimage has been extracted, as it could happen that `current_height - spent_height > REDEEM_AFTER_DOUBLE_SPENT_DELAY` is true even if the preimage has not been extracted yet. For reverse swaps this changes nothing as they always have the preimage. --- electrum/submarine_swaps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py index bf006ac73..0adf5d887 100644 --- a/electrum/submarine_swaps.py +++ b/electrum/submarine_swaps.py @@ -464,7 +464,7 @@ class SwapManager(Logger): if spent_height in [TX_HEIGHT_LOCAL, TX_HEIGHT_FUTURE]: spent_height = None if spent_height is not None: - if spent_height > 0: + if spent_height > 0 and swap.preimage: if current_height - spent_height > REDEEM_AFTER_DOUBLE_SPENT_DELAY: self.logger.info(f'stop watching swap {swap.lockup_address}') swap.is_redeemed = True