Skip to content

Commit

Permalink
pay: specify the channel to send the first hop.
Browse files Browse the repository at this point in the history
If we only specify the node_id, we get the "first" channel.

Closes: #5803
Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: Plugins: `pay` uses the correct local channel for payments when there are multiple available (not just always the first!)
  • Loading branch information
rustyrussell committed Feb 2, 2023
1 parent b300681 commit 0d2eb44
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 1 addition & 0 deletions plugins/libplugin-pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0d2eb44

Please sign in to comment.