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: https://github.com/ElementsProject/lightning/issues/7881
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-12-16 11:20:16 +10:30
parent 8202929a00
commit cf22762c8f
2 changed files with 12 additions and 0 deletions

View file

@ -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);
}

View file

@ -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})