SatSale

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 24ec4f50996af35fe3e65ab198060f08e9b95a06
parent 29d07c2fd23eb40bf2e60866b9c64a06b1d9e84f
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date:   Wed, 17 Mar 2021 19:44:55 +1100

handle local lnd cert copying

Diffstat:
Mpay/lnd.py | 35+++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/pay/lnd.py b/pay/lnd.py @@ -1,4 +1,3 @@ -import config import subprocess import time import os @@ -6,6 +5,7 @@ import json from base64 import b64decode from google.protobuf.json_format import MessageToJson +import config from invoice.payment_invoice import invoice @@ -73,17 +73,28 @@ class lnd(invoice): macaroon_file = os.path.join( config.lnd_dir, "data/chain/bitcoin/mainnet/admin.macaroon" ) - subprocess.run( - ["scp", "{}:{}".format(config.tunnel_host, tls_file), "."] - ) - subprocess.run( - [ - "scp", - "-r", - "{}:{}".format(config.tunnel_host, macaroon_file), - ".", - ] - ) + + # SSH copy + if config.tunnel_host is not None: + subprocess.run( + ["scp", "{}:{}".format(config.tunnel_host, tls_file), "."] + ) + subprocess.run( + [ + "scp", + "-r", + "{}:{}".format(config.tunnel_host, macaroon_file), + ".", + ] + ) + else: + subprocess.run( + ["cp", "{}".format(tls_file), "."] + ) + subprocess.run( + ["cp", "{}".format(macaroon_file), "."] + ) + except Exception as e: print(e) print("Failed to copy tls and macaroon files to local machine.")