diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py index 2496d1978..faf27a8c9 100644 --- a/electrum/lnwatcher.py +++ b/electrum/lnwatcher.py @@ -160,7 +160,8 @@ class LNWatcher(AddressSynchronizer): self.channels[address] = outpoint async def unwatch_channel(self, address, funding_outpoint): - pass + self.logger.info(f'unwatching {funding_outpoint}') + self.channels.pop(address, None) @log_exceptions async def on_network_update(self, event, *args): @@ -170,7 +171,8 @@ class LNWatcher(AddressSynchronizer): if not self.synchronizer: self.logger.info("synchronizer not set yet") return - for address, outpoint in self.channels.items(): + channels_items = list(self.channels.items()) # copy + for address, outpoint in channels_items: await self.check_onchain_situation(address, outpoint) async def check_onchain_situation(self, address, funding_outpoint): @@ -315,7 +317,7 @@ class WatchTower(LNWatcher): return self.network.run_from_another_thread(f()) async def unwatch_channel(self, address, funding_outpoint): - self.logger.info(f'unwatching {funding_outpoint}') + await super().unwatch_channel(address, funding_outpoint) await self.sweepstore.remove_sweep_tx(funding_outpoint) await self.sweepstore.remove_channel(funding_outpoint) if funding_outpoint in self.tx_progress: