URI: 
       tfurther simplify lnwatcher - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 0e3270a1d6db91427c6a2810e97f4a5197e4fc2f
   DIR parent dbc4549c0e85358a6cc6886ca0d3d5b3fb92cffe
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Thu, 22 Nov 2018 12:22:48 +0100
       
       further simplify lnwatcher
       
       Diffstat:
         M electrum/lnwatcher.py               |      12 +++---------
       
       1 file changed, 3 insertions(+), 9 deletions(-)
       ---
   DIR diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py
       t@@ -45,7 +45,6 @@ class LNWatcher(AddressSynchronizer):
                self.config = network.config
                self.start_network(network)
                self.lock = threading.RLock()
       -        self.watched_addresses = set()
                self.channel_info = storage.get('channel_info', {})  # access with 'lock'
                # [funding_outpoint_str][prev_txid] -> set of EncumberedTransaction
                # prev_txid is the txid of a tx that is watched for confirmations
       t@@ -107,7 +106,7 @@ class LNWatcher(AddressSynchronizer):
        
            @with_watchtower
            def watch_channel(self, address, outpoint):
       -        self.watch_address(address)
       +        self.add_address(address)
                with self.lock:
                    if address not in self.channel_info:
                        self.channel_info[address] = outpoint
       t@@ -128,11 +127,6 @@ class LNWatcher(AddressSynchronizer):
                for address, outpoint in channel_info_items:
                    await self.check_onchain_situation(outpoint)
        
       -    def watch_address(self, addr):
       -        with self.lock:
       -            self.watched_addresses.add(addr)
       -            self.add_address(addr)
       -
            async def check_onchain_situation(self, funding_outpoint):
                txid, index = funding_outpoint.split(':')
                ctx_candidate_txid = self.spent_outpoints[txid].get(int(index))
       t@@ -164,8 +158,8 @@ class LNWatcher(AddressSynchronizer):
                # make sure we are subscribed to all outputs of tx
                not_yet_watching = False
                for o in prev_tx.outputs():
       -            if o.address not in self.watched_addresses:
       -                self.watch_address(o.address)
       +            if o.address not in self.get_addresses():
       +                self.add_address(o.address)
                        not_yet_watching = True
                if not_yet_watching:
                    self.print_error('prev_tx', prev_tx, 'not yet watching')