From 762d8be84f6a254e359f37bcb48fa37c8b837ad0 Mon Sep 17 00:00:00 2001 From: Janus Date: Tue, 27 Nov 2018 00:39:39 +0100 Subject: [PATCH] lnaddr: make it possible to use lnaddr to decode arbitrary invoices on the cmd line --- electrum/lnaddr.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/electrum/lnaddr.py b/electrum/lnaddr.py index 5504df0c0..c6f0da976 100644 --- a/electrum/lnaddr.py +++ b/electrum/lnaddr.py @@ -402,3 +402,10 @@ class SerializableKey: self.pubkey = pubkey def serialize(self): return self.pubkey.get_public_key_bytes(True) + +if __name__ == '__main__': + # run using + # python3 -m electrum.lnaddr + # python3 -m electrum.lnaddr lntb1n1pdlcakepp5e7rn0knl0gm46qqp9eqdsza2c942d8pjqnwa5903n39zu28sgk3sdq423jhxapqv3hkuct5d9hkucqp2rzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmj9vk9sqqqlcqqqqqqqlgqqqqqqgqjqdhnmkgahfaynuhe9md8k49xhxuatnv6jckfmsjq8maxta2l0trh5sdrqlyjlwutdnpd5gwmdnyytsl9q0dj6g08jacvthtpeg383k0sq542rz2 tb1n + import sys + print(lndecode(sys.argv[1], expected_hrp=sys.argv[2]))