From 670f8dbe422f0da9463771a3c4b0e991c05738e9 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 1 Apr 2022 13:55:36 +0200 Subject: [PATCH] submarine_swaps: use prevout to determine if a txin is claiming a swap --- electrum/submarine_swaps.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py index dbe2fc99d..540102de2 100644 --- a/electrum/submarine_swaps.py +++ b/electrum/submarine_swaps.py @@ -92,6 +92,7 @@ class SwapData(StoredObject): funding_txid = attr.ib(type=Optional[str]) spending_txid = attr.ib(type=Optional[str]) is_redeemed = attr.ib(type=bool) + _funding_prevout = None # for RBF def create_claim_tx( @@ -171,6 +172,7 @@ class SwapManager(Logger): self.logger.info('amount too low, we should not reveal the preimage') continue swap.funding_txid = txin.prevout.txid.hex() + swap._funding_prevout = txin.prevout spent_height = txin.spent_height if spent_height is not None: swap.spending_txid = txin.spent_txid @@ -542,7 +544,7 @@ class SwapManager(Logger): def get_swap_by_claim_txin(self, txin: TxInput) -> Optional[SwapData]: for key, swap in self.swaps.items(): - if txin.prevout.txid.hex() == swap.funding_txid: + if txin.prevout == swap._funding_prevout: return swap return None