Skip to content

Commit 737b2c6

Browse files
committed
xpay: tell injectpaymentonion what the amount being delivered to destination 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: #7881 Signed-off-by: Rusty Russell <[email protected]>
1 parent dc6a5f8 commit 737b2c6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

plugins/xpay/xpay.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ static struct command_result *do_inject(struct command *aux_cmd,
922922
json_add_u64(req->js, "partid", attempt->partid);
923923
json_add_u64(req->js, "groupid", attempt->payment->group_id);
924924
json_add_string(req->js, "invstring", attempt->payment->invstring);
925+
json_add_amount_msat(req->js, "destination_msat", attempt->delivers);
925926
return send_payment_req(aux_cmd, attempt->payment, req);
926927
}
927928

tests/test_xpay.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,17 @@ def test_xpay_takeover(node_factory, executor):
462462
l1.rpc.pay(inv)
463463
l1.daemon.wait_for_log('Redirecting pay->xpay')
464464

465+
# We get destination and amount_msat in listsendpays and listpays.
466+
ret = only_one(l1.rpc.listsendpays(inv)['payments'])
467+
assert ret['destination'] == l3.info['id']
468+
assert ret['amount_msat'] == 100000
469+
assert ret['amount_sent_msat'] > 100000
470+
471+
ret = only_one(l1.rpc.listpays(inv)['pays'])
472+
assert ret['destination'] == l3.info['id']
473+
assert ret['amount_msat'] == 100000
474+
assert ret['amount_sent_msat'] > 100000
475+
465476

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

0 commit comments

Comments
 (0)