From 76b16a60b32d780c68493bbba83802743e054570 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 23 Jul 2021 21:23:58 +0930 Subject: [PATCH] drain: fix for latest lightningd which require payment_secret. Signed-off-by: Rusty Russell --- drain/drain.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drain/drain.py b/drain/drain.py index 681facb..d650a0d 100755 --- a/drain/drain.py +++ b/drain/drain.py @@ -238,6 +238,8 @@ def try_for_htlc_fee(plugin, payload, peer_id, amount, chunk, spendable_before): description = "%s %s %s%s [%d/%d]" % (payload['command'], payload['scid'], payload['percentage'], '%', chunk + 1, payload['chunks']) invoice = plugin.rpc.invoice("any", label, description, retry_for + 60) payment_hash = invoice['payment_hash'] + # The requirement for payment_secret coincided with its addition to the invoice output. + payment_secret = invoice.get('payment_secret') plugin.log("Invoice payment_hash: %s" % payment_hash) # exclude selected channel to prevent unwanted shortcuts @@ -284,7 +286,7 @@ def try_for_htlc_fee(plugin, payload, peer_id, amount, chunk, spendable_before): try: ours = get_ours(plugin, payload['scid']) - plugin.rpc.sendpay(route, payment_hash, label) + plugin.rpc.sendpay(route, payment_hash, label, payment_secret=payment_secret) running_for = int(time.time()) - start_ts result = plugin.rpc.waitsendpay(payment_hash, max(retry_for - running_for, 0)) if not result.get('status') == 'complete':