Browse Source

lnaddr: make it possible to use lnaddr to decode arbitrary invoices on the cmd line

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
Janus 6 years ago
committed by ThomasV
parent
commit
762d8be84f
  1. 7
      electrum/lnaddr.py

7
electrum/lnaddr.py

@ -402,3 +402,10 @@ class SerializableKey:
self.pubkey = pubkey self.pubkey = pubkey
def serialize(self): def serialize(self):
return self.pubkey.get_public_key_bytes(True) 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]))

Loading…
Cancel
Save