commit a3c6f82bb244b9de44cd2aeae3d0178740309179
parent 42cbe74e95699ccbc293d39ab499b15c6d38f922
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 2 Feb 2019 08:53:06 +0100
move LNPeer handshake back into initialize
Diffstat:
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/electrum/lnbase.py b/electrum/lnbase.py
@@ -232,6 +232,9 @@ class Peer(PrintError):
self.transport.send_bytes(gen_msg(message_name, **kwargs))
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)
@property
diff --git a/electrum/lntransport.py b/electrum/lntransport.py
@@ -214,6 +214,7 @@ class LNTransport(LNTransportBase):
self.remote_pubkey = peer_addr.pubkey
self.host = peer_addr.host
self.port = peer_addr.port
+ self.peer_addr = peer_addr
def name(self):
return str(self.host) + ':' + str(self.port)
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
@@ -249,11 +249,6 @@ class LNWorker(PrintError):
port = int(port)
peer_addr = LNPeerAddr(host, port, node_id)
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.print_error("adding peer", peer_addr)
peer = Peer(self, node_id, transport, request_initial_sync=self.config.get("request_initial_sync", True))