lnwatcher: unwatch deeply mined channels

reduces log spam generated by "REDEEMED" channels...
This commit is contained in:
SomberNight 2020-03-14 04:44:01 +01:00
parent 8897360a72
commit ec6be665d5
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -160,7 +160,8 @@ class LNWatcher(AddressSynchronizer):
self.channels[address] = outpoint self.channels[address] = outpoint
async def unwatch_channel(self, address, funding_outpoint): async def unwatch_channel(self, address, funding_outpoint):
pass self.logger.info(f'unwatching {funding_outpoint}')
self.channels.pop(address, None)
@log_exceptions @log_exceptions
async def on_network_update(self, event, *args): async def on_network_update(self, event, *args):
@ -170,7 +171,8 @@ class LNWatcher(AddressSynchronizer):
if not self.synchronizer: if not self.synchronizer:
self.logger.info("synchronizer not set yet") self.logger.info("synchronizer not set yet")
return 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) await self.check_onchain_situation(address, outpoint)
async def check_onchain_situation(self, address, funding_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()) return self.network.run_from_another_thread(f())
async def unwatch_channel(self, address, funding_outpoint): 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_sweep_tx(funding_outpoint)
await self.sweepstore.remove_channel(funding_outpoint) await self.sweepstore.remove_channel(funding_outpoint)
if funding_outpoint in self.tx_progress: if funding_outpoint in self.tx_progress: