From 9e9686df207b7ebe9793d72e68358c8c0956465e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 2 Feb 2023 12:19:17 +1030 Subject: [PATCH] pay: specify the channel to send the first hop. If we only specify the node_id, we get the "first" channel. Closes: #5803 Signed-off-by: Rusty Russell Changelog-Fixed: Plugins: `pay` uses the correct local channel for payments when there are multiple available (not just always the first!) --- plugins/libplugin-pay.c | 1 + tests/test_pay.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 05ed22be1..1eb7edb02 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -1573,6 +1573,7 @@ static struct command_result *payment_createonion_success(struct command *cmd, json_add_amount_msat_only(req->js, "amount_msat", first->amount); json_add_num(req->js, "delay", first->delay); json_add_node_id(req->js, "id", &first->node_id); + json_add_short_channel_id(req->js, "channel", &first->scid); json_object_end(req->js); json_add_sha256(req->js, "payment_hash", p->payment_hash); diff --git a/tests/test_pay.py b/tests/test_pay.py index f8017948d..20f5feee6 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -5305,7 +5305,6 @@ def test_payerkey(node_factory): assert n.rpc.decode(b12)['invreq_payer_id'] == k -@pytest.mark.xfail(strict=True) def test_cln_sendpay_weirdness(bitcoind, node_factory): # 0. Setup