Skip to content

Commit

Permalink
Merge pull request #45 from PierreRochard/macos-bugs
Browse files Browse the repository at this point in the history
Macos bugs
  • Loading branch information
PierreRochard authored Dec 9, 2018
2 parents 28223ec + 8f7d4dd commit f368528
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Requirements
1. ~300 GB of download bandwidth
2. ~7 GB of disk space (~300 GB if you want the Bitcoin transaction index, makes for a faster LND)
3. Windows or macOS
3. Windows 7+ or macOS 10.12.6+

Please submit a pull request if you want to add Linux support! Next year is the Year of Desktop Linux...

Expand Down
10 changes: 7 additions & 3 deletions node_launcher/node_set/bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Optional, List

import psutil
from psutil import AccessDenied

from node_launcher.services.bitcoin_software import BitcoinSoftware
from node_launcher.services.configuration_file import ConfigurationFile
Expand Down Expand Up @@ -72,9 +73,12 @@ def find_running_node(self) -> psutil.Process:
ports = [18333, 18332]
for process in psutil.process_iter():
if 'bitcoin' in process.name():
for connection in process.connections():
if connection.laddr.port in ports:
return process
try:
for connection in process.connections():
if connection.laddr.port in ports:
return process
except AccessDenied:
continue

def detect_zmq_ports(self) -> bool:
if self.process is None:
Expand Down
15 changes: 10 additions & 5 deletions node_launcher/node_set/lnd_client/lnd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@
class LndClient(object):
def __init__(self, lnd: Lnd):
self.lnd = lnd
lnd_tls_cert_path = os.path.join(self.lnd.lnddir, 'tls.cert')
self.lnd_tls_cert = open(lnd_tls_cert_path, 'rb').read()
self.cert_credentials = grpc.ssl_channel_credentials(self.lnd_tls_cert)
self.cert_credentials = None

def get_cert_credentials(self):
if self.cert_credentials is None:
lnd_tls_cert_path = os.path.join(self.lnd.lnddir, 'tls.cert')
lnd_tls_cert = open(lnd_tls_cert_path, 'rb').read()
self.cert_credentials = grpc.ssl_channel_credentials(lnd_tls_cert)
return self.cert_credentials

def wallet_unlocker(self):
grpc_channel = grpc.secure_channel(f'localhost:{self.lnd.grpc_port}',
credentials=self.cert_credentials)
credentials=self.get_cert_credentials())
return lnrpc.WalletUnlockerStub(grpc_channel)

# noinspection PyUnusedLocal
Expand All @@ -40,7 +45,7 @@ def metadata_callback(self,

def lnd_client(self):
auth_credentials = grpc.metadata_call_credentials(self.metadata_callback)
credentials = grpc.composite_channel_credentials(self.cert_credentials,
credentials = grpc.composite_channel_credentials(self.get_cert_credentials(),
auth_credentials)
grpc_channel = grpc.secure_channel(f'localhost:{self.lnd.grpc_port}',
credentials)
Expand Down

0 comments on commit f368528

Please sign in to comment.