From 197e98560d95b8e8458fda2d3aad886ce7fd8b51 Mon Sep 17 00:00:00 2001 From: cryptosharks131 Date: Tue, 26 Dec 2023 10:41:55 -0500 Subject: [PATCH] Cache grpc creds + expiry UTC --- gui/lnd_deps/lnd_connect.py | 7 ++++--- gui/templates/trades.html | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gui/lnd_deps/lnd_connect.py b/gui/lnd_deps/lnd_connect.py index ecef6f86..cac664d7 100644 --- a/gui/lnd_deps/lnd_connect.py +++ b/gui/lnd_deps/lnd_connect.py @@ -1,7 +1,7 @@ import os, codecs, grpc from lndg import settings -def creds(): +def get_creds(): #Open connection with lnd via grpc with open(os.path.expanduser(settings.LND_MACAROON_PATH), 'rb') as f: macaroon_bytes = f.read() @@ -15,11 +15,12 @@ def metadata_callback(context, callback): creds = grpc.composite_channel_credentials(cert_creds, auth_creds) return creds +creds = get_creds() def lnd_connect(): - return grpc.secure_channel(settings.LND_RPC_SERVER, creds(), options=[('grpc.max_send_message_length', int(settings.LND_MAX_MESSAGE)*1000000), ('grpc.max_receive_message_length', int(settings.LND_MAX_MESSAGE)*1000000),]) + return grpc.secure_channel(settings.LND_RPC_SERVER, creds, options=[('grpc.max_send_message_length', int(settings.LND_MAX_MESSAGE)*1000000), ('grpc.max_receive_message_length', int(settings.LND_MAX_MESSAGE)*1000000),]) def async_lnd_connect(): - return grpc.aio.secure_channel(settings.LND_RPC_SERVER, creds(), options=[('grpc.max_send_message_length', int(settings.LND_MAX_MESSAGE)*1000000), ('grpc.max_receive_message_length', int(settings.LND_MAX_MESSAGE)*1000000),]) + return grpc.aio.secure_channel(settings.LND_RPC_SERVER, creds, options=[('grpc.max_send_message_length', int(settings.LND_MAX_MESSAGE)*1000000), ('grpc.max_receive_message_length', int(settings.LND_MAX_MESSAGE)*1000000),]) def main(): pass diff --git a/gui/templates/trades.html b/gui/templates/trades.html index 15c9f6a8..7ffcf1d6 100644 --- a/gui/templates/trades.html +++ b/gui/templates/trades.html @@ -25,7 +25,7 @@

Create A Trade

-
+ UTC

@@ -94,7 +94,7 @@

Create A Trade

function setExpiry(obj){ const trade_row = obj.parentElement.parentElement const trade_id = trade_row.cells[0].id - if (confirm(`Set new expiry for trade ${trade_id.substring(0,7)} to ${obj.value}?`)){ + if (confirm(`Set new expiry for trade ${trade_id.substring(0,7)} to ${obj.value} UTC?`)){ Sync.PUT(`trades/${trade_id}`, {"body": {"expiry": obj.value}}, ts => trade_row.outerHTML=use(base_trade_template).render(ts).outerHTML) } }