From 71a2aefafdf2553e53834235b6e3a12d41cf65b6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 26 Jul 2020 10:37:58 +0930 Subject: [PATCH] sendonion: add bolt11 arg. And document the partid arg. Signed-off-by: Rusty Russell Changelog-Added: JSON-RPC: `sendonion` has a new optional `bolt11` argument for when it's used to pay an invoice. --- doc/lightning-sendonion.7 | 10 +++++++++- doc/lightning-sendonion.7.md | 8 +++++++- lightningd/pay.c | 5 +++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doc/lightning-sendonion.7 b/doc/lightning-sendonion.7 index c18554d45..47f6a44a2 100644 --- a/doc/lightning-sendonion.7 +++ b/doc/lightning-sendonion.7 @@ -3,7 +3,7 @@ lightning-sendonion - Send a payment with a custom onion packet .SH SYNOPSIS -\fBsendonion\fR \fIonion\fR \fIfirst_hop\fR \fIpayment_hash\fR [\fIlabel\fR] [\fIshared_secrets\fR] +\fBsendonion\fR \fIonion\fR \fIfirst_hop\fR \fIpayment_hash\fR [\fIlabel\fR] [\fIshared_secrets\fR] [\fIpartid\fR] [\fIbolt11\fR] .SH DESCRIPTION @@ -81,6 +81,14 @@ If \fIshared_secrets\fR is not provided the c-lightning node does not know how long the route is, which channels or nodes are involved, and what an eventual error could have been\. It can therefore be used for oblivious payments\. + +The \fIpartid\fR value, if provided and non-zero, allows for multiple parallel +partial payments with the same \fIpayment_hash\fR\. + + +The \fIbolt11\fR parameter, if provided, will be returned in +\fIwaitsendpay\fR and \fIlistsendpays\fR results\. + .SH RETURN VALUE On success, an object similar to the output of \fBsendpay\fR will be diff --git a/doc/lightning-sendonion.7.md b/doc/lightning-sendonion.7.md index 07805734f..28ca83977 100644 --- a/doc/lightning-sendonion.7.md +++ b/doc/lightning-sendonion.7.md @@ -4,7 +4,7 @@ lightning-sendonion -- Send a payment with a custom onion packet SYNOPSIS -------- -**sendonion** *onion* *first_hop* *payment_hash* \[*label*\] \[*shared_secrets*\] +**sendonion** *onion* *first_hop* *payment_hash* \[*label*\] \[*shared_secrets*\] \[*partid*\] \[*bolt11*\] DESCRIPTION ----------- @@ -72,6 +72,12 @@ If *shared_secrets* is not provided the c-lightning node does not know how long the route is, which channels or nodes are involved, and what an eventual error could have been. It can therefore be used for oblivious payments. +The *partid* value, if provided and non-zero, allows for multiple parallel +partial payments with the same *payment_hash*. + +The *bolt11* parameter, if provided, will be returned in +*waitsendpay* and *listsendpays* results. + RETURN VALUE ------------ diff --git a/lightningd/pay.c b/lightningd/pay.c index 178d1b187..1322ec06b 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -1183,7 +1183,7 @@ static struct command_result *json_sendonion(struct command *cmd, struct route_hop *first_hop; struct sha256 *payment_hash; struct lightningd *ld = cmd->ld; - const char *label; + const char *label, *b11str; struct secret *path_secrets; u64 *partid; @@ -1194,6 +1194,7 @@ static struct command_result *json_sendonion(struct command *cmd, p_opt("label", param_escaped_string, &label), p_opt("shared_secrets", param_secrets_array, &path_secrets), p_opt_def("partid", param_u64, &partid, 0), + p_opt("bolt11", param_string, &b11str), NULL)) return command_param_failed(); @@ -1207,7 +1208,7 @@ static struct command_result *json_sendonion(struct command *cmd, return send_payment_core(ld, cmd, payment_hash, *partid, first_hop, AMOUNT_MSAT(0), AMOUNT_MSAT(0), - label, NULL, &packet, NULL, NULL, NULL, + label, b11str, &packet, NULL, NULL, NULL, path_secrets); }