commit 182d95d007b5f503e5e83c86314e9a1067bb929f
parent ea98e25f4ff14b2deb5a2cf1cb6232ef85f93e3b
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date: Mon, 8 Mar 2021 11:18:26 +1100
getinfo only called on initial test connection upon startup
Diffstat:
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/invoice/payment_invoice.py b/invoice/payment_invoice.py
@@ -6,7 +6,7 @@ from .price_feed import get_btc_value
class invoice:
- def __init__(self, dollar_value, currency, label):
+ def __init__(self, dollar_value, currency, label, test=False):
self.dollar_value = dollar_value
self.currency = currency
self.value = round(get_btc_value(dollar_value, currency), 8)
@@ -19,6 +19,7 @@ class invoice:
self.unconfirmed_paid = 0
self.paid = False
self.txid = ""
+ self.test = test
def create_qr(self):
if config.pay_method == "lnd":
diff --git a/pay/bitcoind.py b/pay/bitcoind.py
@@ -4,8 +4,8 @@ from invoice.payment_invoice import invoice
class btcd(invoice):
- def __init__(self, dollar_value, currency, label):
- super().__init__(dollar_value, currency, label)
+ def __init__(self, dollar_value, currency, label, test):
+ super().__init__(dollar_value, currency, label, test)
print(self.__dict__)
# self.__dict__ = invoice.__dict__.copy()
@@ -19,8 +19,11 @@ class btcd(invoice):
for i in range(config.connection_attempts):
try:
self.rpc = AuthServiceProxy(connection_str)
- info = self.rpc.getblockchaininfo()
- print(info)
+
+ if test:
+ info = self.rpc.getblockchaininfo()
+ print(info)
+
print("Successfully contacted bitcoind.")
break
diff --git a/pay/lnd.py b/pay/lnd.py
@@ -10,8 +10,8 @@ from invoice.payment_invoice import invoice
class lnd(invoice):
- def __init__(self, dollar_value, currency, label):
- super().__init__(dollar_value, currency, label)
+ def __init__(self, dollar_value, currency, label, test):
+ super().__init__(dollar_value, currency, label, test)
print(self.__dict__)
from lndgrpc import LNDClient
@@ -37,9 +37,10 @@ class lnd(invoice):
cert_filepath="tls.cert",
)
- print("Getting lnd info...")
- info = self.lnd.get_info()
- print(info)
+ if test:
+ print("Getting lnd info...")
+ info = self.lnd.get_info()
+ print(info)
print("Successfully contacted lnd.")
break