From 86f3eec8e63db075b438236587c9ddd2ba7ebc00 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 10 Jun 2025 10:44:04 +0200 Subject: [PATCH] fix user-facing exception refreshing history after swap is refunded (txbatcher first adds the tx unsigned) --- electrum/submarine_swaps.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py index 8770bd859..f9747fda3 100644 --- a/electrum/submarine_swaps.py +++ b/electrum/submarine_swaps.py @@ -367,7 +367,11 @@ class SwapManager(Logger): @classmethod def extract_preimage(cls, swap: SwapData, claim_tx: Transaction) -> Optional[bytes]: for txin in claim_tx.inputs(): - preimage = txin.witness_elements()[1] + witness = txin.witness_elements() + if not witness: + # tx may be unsigned + continue + preimage = witness[1] if sha256(preimage) == swap.payment_hash: return preimage return None