From 69503bbeb4d8bcae47a8b09de10dbdf42feaa53d Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 7 Nov 2024 11:22:52 +0100 Subject: [PATCH] submarine swaps: disable tx batching, because we need to handle the case where base_tx gets mined instead of the replacing tx. Also, call adb.add_transaction before broadcasting, to prevent races. --- electrum/submarine_swaps.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py index e42b278d7..5730ddd8d 100644 --- a/electrum/submarine_swaps.py +++ b/electrum/submarine_swaps.py @@ -426,11 +426,16 @@ class SwapManager(Logger): swap = self.swaps[key] if swap.funding_txid is None: password = self.wallet.get_unlocked_password() - for batch_rbf in [True, False]: + for batch_rbf in [False]: + # FIXME: tx batching is disabled, because extra logic is needed to handle + # the case where the base tx gets mined. tx = self.create_funding_tx(swap, None, password=password, batch_rbf=batch_rbf) + self.logger.info(f'adding funding_tx {tx.txid()}') + self.wallet.adb.add_transaction(tx) try: await self.broadcast_funding_tx(swap, tx) except TxBroadcastError: + self.wallet.adb.remove_transaction(tx.txid()) continue break