@@ -448,6 +448,7 @@ def __init__(
448448 self ._extraFee = QEAmount ()
449449 self ._canRbf = False
450450 self ._swapStatusMsg = ''
451+ self ._busy = False
451452 self .swap_task : Future = None
452453
453454 self .swapAvailabilityChanged .connect (self .on_swap_availability_changed , Qt .ConnectionType .QueuedConnection )
@@ -489,6 +490,17 @@ def amount(self, amount: QEAmount):
489490 self ._amount .copyFrom (amount )
490491 self .amountChanged .emit ()
491492
493+ busyChanged = pyqtSignal ()
494+ @pyqtProperty (bool , notify = busyChanged )
495+ def busy (self ) -> bool :
496+ return self ._busy
497+
498+ @busy .setter
499+ def busy (self , busy : bool ):
500+ if self ._busy != busy :
501+ self ._busy = busy
502+ self .busyChanged .emit ()
503+
492504 effectiveAmountChanged = pyqtSignal ()
493505 @pyqtProperty (QEAmount , notify = effectiveAmountChanged )
494506 def effectiveAmount (self ):
@@ -642,6 +654,10 @@ def signAndSend(self):
642654 self ._logger .debug ('no valid tx' )
643655 return
644656
657+ if self .busy :
658+ self ._logger .debug ('busy' )
659+ return
660+
645661 tx = self ._tx
646662
647663 if self .f_accept :
@@ -659,6 +675,8 @@ def _send_with_swap_change(self, tx):
659675 assert self ._wallet .wallet .lnworker
660676 assert tx .get_dummy_output (DummyAddress .SWAP )
661677
678+ self .busy = True
679+
662680 async def handle_swap_task ():
663681 try :
664682 swap_dummy_output = tx .get_dummy_output (DummyAddress .SWAP )
@@ -717,6 +735,7 @@ async def handle_swap_task():
717735 finally :
718736 # ensures that swap_task is always set None if transport closes
719737 self .swap_task = None
738+ self .busy = False
720739
721740 self .swap_task = asyncio .run_coroutine_threadsafe (handle_swap_task (), get_asyncio_loop ())
722741
0 commit comments