electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 61638664f769fa28d33711115c849267517ede08
parent 472e82e3871e9fe8535a2750dfd9f5ea7dcb2e4e
Author: ThomasV <thomasv@electrum.org>
Date:   Fri,  1 Feb 2019 19:05:57 +0100

do not add ephemeral addresses to recent peers

Diffstat:
Melectrum/lnbase.py | 6++++--
Melectrum/lnworker.py | 2+-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/electrum/lnbase.py b/electrum/lnbase.py @@ -197,8 +197,9 @@ def gen_msg(msg_type: str, **kwargs) -> bytes: class Peer(PrintError): - def __init__(self, lnworker: 'LNWorker', peer_addr: LNPeerAddr, + def __init__(self, lnworker: 'LNWorker', peer_addr: LNPeerAddr, responding=False, request_initial_sync=False, transport: LNTransportBase=None): + self.responding = responding self.initialized = asyncio.Event() self.transport = transport self.peer_addr = peer_addr @@ -372,7 +373,8 @@ class Peer(PrintError): except (OSError, asyncio.TimeoutError, HandshakeFailed) as e: self.print_error('initialize failed, disconnecting: {}'.format(repr(e))) return - self.channel_db.add_recent_peer(self.peer_addr) + if not self.responding: + self.channel_db.add_recent_peer(self.peer_addr) # loop async for msg in self.transport.read_messages(): self.process_message(msg) diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -804,7 +804,7 @@ class LNWorker(PrintError): self.print_error('handshake failure from incoming connection') return # FIXME extract host and port from transport - peer = Peer(self, LNPeerAddr("bogus", 1337, node_id), + peer = Peer(self, LNPeerAddr("bogus", 1337, node_id), responding=True, request_initial_sync=self.config.get("request_initial_sync", True), transport=t) self.peers[node_id] = peer