From 7a6c29fe642eaa7fbc47befabf4cab9a48d63485 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Tue, 18 Jan 2022 12:52:10 -0800 Subject: [PATCH] Silence initialization of nick generator --- api/management/commands/follow_invoices.py | 12 ++++++++---- api/nick_generator/nick_generator.py | 15 ++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/api/management/commands/follow_invoices.py b/api/management/commands/follow_invoices.py index d00c5e68..4248ff1d 100644 --- a/api/management/commands/follow_invoices.py +++ b/api/management/commands/follow_invoices.py @@ -59,12 +59,16 @@ class Command(BaseCommand): request = LNNode.invoicesrpc.LookupInvoiceMsg(payment_hash=bytes.fromhex(hold_lnpayment.payment_hash)) response = stub.LookupInvoiceV2(request, metadata=[('macaroon', MACAROON.hex())]) hold_lnpayment.status = lnd_state_to_lnpayment_status[response.state] - - # If it fails at finding the invoice it has been canceled. - # On RoboSats DB we make a distinction between cancelled and returned (LND does not) + except Exception as e: + # If it fails at finding the invoice it has been canceled. + # On RoboSats DB we make a distinction between cancelled and returned (LND does not) if 'unable to locate invoice' in str(e): hold_lnpayment.status = LNPayment.Status.CANCEL + # LND restarted. + if 'wallet locked, unlock it to enable full RPC access' in str(e): + self.stdout.write(str(timezone.now())+':: Wallet Locked') + # Other write to logs else: self.stdout.write(str(e)) @@ -121,7 +125,7 @@ class Command(BaseCommand): except Exception as e: self.stdout.write(str(e)) - # TODO If an lnpayment goes from LOCKED to INVGED. Totally weird + # TODO If a lnpayment goes from LOCKED to INVGED. Totally weird # halt the order if lnpayment.status == LNPayment.Status.LOCKED: pass \ No newline at end of file diff --git a/api/nick_generator/nick_generator.py b/api/nick_generator/nick_generator.py index 29e5e84a..93371619 100755 --- a/api/nick_generator/nick_generator.py +++ b/api/nick_generator/nick_generator.py @@ -41,13 +41,14 @@ class NickGenerator: else: raise ValueError("Language not implemented.") - print( - f"{lang} SHA256 Nick Generator initialized with:" - + f"\nUp to {len(adverbs)} adverbs." - + f"\nUp to {len(adjectives)} adjectives." - + f"\nUp to {len(nouns)} nouns." - + f"\nUp to {max_num+1} numerics.\n" - ) + if verbose: + print( + f"{lang} SHA256 Nick Generator initialized with:" + + f"\nUp to {len(adverbs)} adverbs." + + f"\nUp to {len(adjectives)} adjectives." + + f"\nUp to {len(nouns)} nouns." + + f"\nUp to {max_num+1} numerics.\n" + ) self.use_adv = use_adv self.use_adj = use_adj