Skip to content

Commit

Permalink
Cache grpc creds + expiry UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptosharks131 committed Dec 26, 2023
1 parent 901e62f commit 197e985
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions gui/lnd_deps/lnd_connect.py
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gui/templates/trades.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2>Create A Trade</h2>
</div>

<label for="expiry">Optional Expiration:</label>
<input type="datetime-local" id="expiry" name="expiry"><br>
<input type="datetime-local" id="expiry" name="expiry"> UTC<br>

<label for="sale_limit">Optional Sale Limit:</label>
<input type="number" min="0" id="sale_limit" name="sale_limit"><br>
Expand Down Expand Up @@ -94,7 +94,7 @@ <h2>Create A Trade</h2>
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)
}
}
Expand Down

0 comments on commit 197e985

Please sign in to comment.