Browse Source

move LNPeer handshake back into initialize

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
a3c6f82bb2
  1. 3
      electrum/lnbase.py
  2. 1
      electrum/lntransport.py
  3. 5
      electrum/lnworker.py

3
electrum/lnbase.py

@ -232,6 +232,9 @@ class Peer(PrintError):
self.transport.send_bytes(gen_msg(message_name, **kwargs)) self.transport.send_bytes(gen_msg(message_name, **kwargs))
async def initialize(self): async def initialize(self):
if isinstance(self.transport, LNTransport):
await self.transport.handshake()
self.channel_db.add_recent_peer(self.transport.peer_addr)
self.send_message("init", gflen=0, lflen=1, localfeatures=self.localfeatures) self.send_message("init", gflen=0, lflen=1, localfeatures=self.localfeatures)
@property @property

1
electrum/lntransport.py

@ -214,6 +214,7 @@ class LNTransport(LNTransportBase):
self.remote_pubkey = peer_addr.pubkey self.remote_pubkey = peer_addr.pubkey
self.host = peer_addr.host self.host = peer_addr.host
self.port = peer_addr.port self.port = peer_addr.port
self.peer_addr = peer_addr
def name(self): def name(self):
return str(self.host) + ':' + str(self.port) return str(self.host) + ':' + str(self.port)

5
electrum/lnworker.py

@ -249,11 +249,6 @@ class LNWorker(PrintError):
port = int(port) port = int(port)
peer_addr = LNPeerAddr(host, port, node_id) peer_addr = LNPeerAddr(host, port, node_id)
transport = LNTransport(self.node_keypair.privkey, peer_addr) transport = LNTransport(self.node_keypair.privkey, peer_addr)
try:
await transport.handshake()
except:
return
self.channel_db.add_recent_peer(peer_addr)
self._last_tried_peer[peer_addr] = time.time() self._last_tried_peer[peer_addr] = time.time()
self.print_error("adding peer", peer_addr) self.print_error("adding peer", peer_addr)
peer = Peer(self, node_id, transport, request_initial_sync=self.config.get("request_initial_sync", True)) peer = Peer(self, node_id, transport, request_initial_sync=self.config.get("request_initial_sync", True))

Loading…
Cancel
Save