URI: 
       tlightning: store network view - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1c3e9b0cf8779a7f53d6b3a33aba56aa1c1afc88
   DIR parent e4b188c7142fde4e5e023da6619425d98323d22e
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Sun, 15 Apr 2018 22:37:45 +0200
       
       lightning: store network view
       
       Diffstat:
         M lib/lnbase.py                       |      24 ++++++++++++++++++++----
       
       1 file changed, 20 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/lib/lnbase.py b/lib/lnbase.py
       t@@ -310,8 +310,11 @@ class Peer(PrintError):
                self.temporary_channel_id_to_incoming_funding_signed = {}
                self.init_message_received_future = asyncio.Future()
                self.localfeatures = 0x08 # request initial sync
       +        # view of the network
                self.nodes = {} # received node announcements
                self.channels = {} # received channel announcements
       +        self.channel_u_origin = {}
       +        self.channel_u_final = {}
        
            def diagnostic_name(self):
                return self.host
       t@@ -466,17 +469,30 @@ class Peer(PrintError):
                    else:
                        pass
                    continue
       -        self.print_error('node announcement', binascii.hexlify(pubkey), addresses)
       -        self.nodes[pubkey] = {'addresses': addresses}
       +        alias = payload['alias'].rstrip(b'\x00')
       +        self.nodes[pubkey] = {
       +            'aliass': alias,
       +            'addresses': addresses
       +        }
       +        self.print_error('node announcement', binascii.hexlify(pubkey), alias, addresses)
        
            def on_init(self, payload):
                pass
        
            def on_channel_update(self, payload):
       -        self.print_error('channel update')
       +        flags = int.from_bytes(payload['flags'], byteorder="big")
       +        direction = bool(flags & 1)
       +        short_channel_id = payload['short_channel_id']
       +        if direction:
       +            self.channel_u_origin[short_channel_id] = payload
       +        else:
       +            self.channel_u_final[short_channel_id] = payload
       +        self.print_error('channel update', binascii.hexlify(short_channel_id), flags)
        
            def on_channel_announcement(self, payload):
       -        self.print_error('channel announcement')
       +        short_channel_id = payload['short_channel_id']
       +        self.print_error('channel announcement', binascii.hexlify(short_channel_id))
       +        self.channels[short_channel_id] = payload
        
            #def open_channel(self, funding_sat, push_msat):
            #    self.send_message(gen_msg('open_channel', funding_satoshis=funding_sat, push_msat=push_msat))