commit 762d8be84f6a254e359f37bcb48fa37c8b837ad0 parent 92564724859af08619ab2746d47af739220c39f6 Author: Janus <ysangkok@gmail.com> Date: Tue, 27 Nov 2018 00:39:39 +0100 lnaddr: make it possible to use lnaddr to decode arbitrary invoices on the cmd line Diffstat:
M | electrum/lnaddr.py | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git 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 <invoice> <expected hrp> + # python3 -m electrum.lnaddr lntb1n1pdlcakepp5e7rn0knl0gm46qqp9eqdsza2c942d8pjqnwa5903n39zu28sgk3sdq423jhxapqv3hkuct5d9hkucqp2rzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmj9vk9sqqqlcqqqqqqqlgqqqqqqgqjqdhnmkgahfaynuhe9md8k49xhxuatnv6jckfmsjq8maxta2l0trh5sdrqlyjlwutdnpd5gwmdnyytsl9q0dj6g08jacvthtpeg383k0sq542rz2 tb1n + import sys + print(lndecode(sys.argv[1], expected_hrp=sys.argv[2]))