Skip to content

Commit

Permalink
xpay: tell injectpaymentonion what the amount being delivered to dest…
Browse files Browse the repository at this point in the history
…ination is.

This means that it gets shown in listsendpays: omitting this broke spark, apparently!

Changelog-Changed: `xpay` now populates more fields, so `listsendpays` and `listpays` show `destination` and `amount_msat` fields for xpay payments.
Fixes: ElementsProject#7881
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Dec 17, 2024
1 parent dc6a5f8 commit 737b2c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/xpay/xpay.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ static struct command_result *do_inject(struct command *aux_cmd,
json_add_u64(req->js, "partid", attempt->partid);
json_add_u64(req->js, "groupid", attempt->payment->group_id);
json_add_string(req->js, "invstring", attempt->payment->invstring);
json_add_amount_msat(req->js, "destination_msat", attempt->delivers);
return send_payment_req(aux_cmd, attempt->payment, req);
}

Expand Down
11 changes: 11 additions & 0 deletions tests/test_xpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,17 @@ def test_xpay_takeover(node_factory, executor):
l1.rpc.pay(inv)
l1.daemon.wait_for_log('Redirecting pay->xpay')

# We get destination and amount_msat in listsendpays and listpays.
ret = only_one(l1.rpc.listsendpays(inv)['payments'])
assert ret['destination'] == l3.info['id']
assert ret['amount_msat'] == 100000
assert ret['amount_sent_msat'] > 100000

ret = only_one(l1.rpc.listpays(inv)['pays'])
assert ret['destination'] == l3.info['id']
assert ret['amount_msat'] == 100000
assert ret['amount_sent_msat'] > 100000


def test_xpay_preapprove(node_factory):
l1, l2 = node_factory.line_graph(2, opts={'dev-hsmd-fail-preapprove': None})
Expand Down

0 comments on commit 737b2c6

Please sign in to comment.