Skip to content

Commit

Permalink
cleanup lightning-pay
Browse files Browse the repository at this point in the history
No json.dumps, make bolt11 a required argument (better usage output instead of assertion error)
  • Loading branch information
darosior authored and niftynei committed Oct 29, 2019
1 parent 8a9650c commit f690c35
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contrib/pylightning/lightning-pay
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import argparse
import os
import pprint
import sys
import json
from lightning import LightningRpc

parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("bolt11_or_destination_id")
parser.add_argument("bolt11_or_destination_id", required=True)
parser.add_argument("amount_in_milli_satoshi", default=None, type=int, nargs="?")
parser.add_argument("payment_hash", nargs="?")
parser.add_argument("min_final_cltv_expiry", nargs="?")
Expand All @@ -31,7 +31,8 @@ use_bolt11 = args.bolt11_or_destination_id[:2] == "ln"

if use_bolt11:
bolt11 = ld.decodepay(args.bolt11_or_destination_id)
print("Bolt11 decoded:\n%s" % json.dumps(bolt11, indent=4))
print("Bolt11 decoded:")
pprint.pprint(bolt11)
id_ = bolt11["payee"]
payment_hash = bolt11["payment_hash"]
if "msatoshi" in bolt11:
Expand Down

0 comments on commit f690c35

Please sign in to comment.