commit ec6be665d56c3517bdc48a59f94e3165fca328a1
parent 8897360a720381cc03c59af5e3b71477ee85fe86
Author: SomberNight <somber.night@protonmail.com>
Date: Sat, 14 Mar 2020 04:44:01 +0100
lnwatcher: unwatch deeply mined channels
reduces log spam generated by "REDEEMED" channels...
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git 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: