From 4daa1b37ec2b036dbce8efc01c92a940a8d8a6df Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 19 Jun 2022 16:43:11 +0930 Subject: [PATCH] contrib/pylightning: remove lightning-pay helper. This example predates the pay plugin! It's obsolete, unmaintained, and probably doesn't work. Signed-off-by: Rusty Russell --- Makefile | 2 +- contrib/pylightning/lightning-pay | 74 ------------------------------- contrib/pylightning/setup.py | 1 - 3 files changed, 1 insertion(+), 76 deletions(-) delete mode 100755 contrib/pylightning/lightning-pay diff --git a/Makefile b/Makefile index ba8e5d850..809ae4eca 100644 --- a/Makefile +++ b/Makefile @@ -490,7 +490,7 @@ check-markdown: check-spelling: @tools/check-spelling.sh -PYSRC=$(shell git ls-files "*.py" | grep -v /text.py) contrib/pylightning/lightning-pay +PYSRC=$(shell git ls-files "*.py" | grep -v /text.py) # Some tests in pyln will need to find lightningd to run, so have a PATH that # allows it to find that diff --git a/contrib/pylightning/lightning-pay b/contrib/pylightning/lightning-pay deleted file mode 100755 index d7aa11170..000000000 --- a/contrib/pylightning/lightning-pay +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os -import pprint -import sys -from lightning import LightningRpc - -parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) -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="?") -args = parser.parse_args() - - -def default_configdir(): - home = os.getenv("HOME") - if home: - return os.path.join(home, ".lightning") - return "." - - -rpc_path = os.path.join(default_configdir(), "lightning-rpc") -ld = LightningRpc(rpc_path) - -assert len(args.bolt11_or_destination_id) > 2, "argument bolt11_or_destination_id is invalid" - -# Bolt11 passed if prefix is 'ln' -use_bolt11 = args.bolt11_or_destination_id[:2] == "ln" - -if use_bolt11: - bolt11 = ld.decodepay(args.bolt11_or_destination_id) - print("Bolt11 decoded:") - pprint.pprint(bolt11) - id_ = bolt11["payee"] - payment_hash = bolt11["payment_hash"] - if "msatoshi" in bolt11: - amount_included_in_bolt = True - amount = bolt11["msatoshi"] - else: - assert args.amount_in_milli_satoshi, "need argument amount_in_milli_satoshi" - amount = args.amount_in_milli_satoshi - amount_included_in_bolt = False - - reply = input("Pay %s msatoshi [Y/n]? " % amount) - - if reply in ["y", "Y"]: - if amount_included_in_bolt: - ld.pay(args.bolt11_or_destination_id) - else: - ld.pay(args.bolt11_or_destination_id, amount) - else: - print("Not sending.") - -else: - assert args.amount_in_milli_satoshi, "need argument amount_in_milli_satoshi" - assert args.payment_hash, "need argument payment_hash" - assert args.min_final_cltv_expiry, "need argument min_final_cltv_expiry" - amount = args.amount_in_milli_satoshi - id_ = args.bolt11_or_destination_id - payment_hash = args.payment_hash - min_cltv_expiry = args.min_final_cltv_expiry - - route = ld.getroute(id_, amount, 1, min_cltv_expiry) - fee = route["route"][0]["msatoshi"] - amount - - reply = input("Paying fee %s on amount %s (%.3f%%). Send [Y/n]? " % (fee, amount, fee / amount * 100.0)) - - if reply in ["y", "Y"]: - ld.sendpay(route["route"], payment_hash) - else: - print("Not sending.") - sys.exit(1) diff --git a/contrib/pylightning/setup.py b/contrib/pylightning/setup.py index 5b841d300..f2eefc485 100644 --- a/contrib/pylightning/setup.py +++ b/contrib/pylightning/setup.py @@ -19,6 +19,5 @@ setup(name='pylightning', author_email='decker.christian@gmail.com', license='MIT', packages=['lightning'], - scripts=['lightning-pay'], zip_safe=True, install_requires=requirements)