pay/sendpay: also store description in case bolt11 uses description_hash.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-04-02 13:03:35 +10:30
parent d5c736fe86
commit e47786da04
13 changed files with 82 additions and 11 deletions

View File

@@ -65,6 +65,7 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd,
p->temp_exclusion = NULL;
p->failroute_retry = false;
p->invstring = NULL;
p->description = NULL;
p->routetxt = NULL;
p->max_htlcs = UINT32_MAX;
p->aborterror = NULL;
@@ -1568,6 +1569,9 @@ static struct command_result *payment_createonion_success(struct command *cmd,
/* FIXME: rename parameter to invstring */
json_add_string(req->js, "bolt11", p->invstring);
if (p->description)
json_add_string(req->js, "description", p->description);
if (p->destination)
json_add_node_id(req->js, "destination", p->destination);
@@ -3559,6 +3563,8 @@ static void presplit_cb(struct presplit_mod_data *d, struct payment *p)
* they'll be used when aggregating the payments
* again. */
c->invstring = tal_strdup(c, p->invstring);
if (p->description)
c->description = tal_strdup(c, p->description);
/* Get ~ target, but don't exceed amt */
c->amount = fuzzed_near(target, amt);