mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
jsonrpc: Add msatoshi argument to sendonion to annotate
While not directly necessary, it still feeds the `listpays` result, and so we should pass it along if we can, so we don't have to rely solely on the `amount_sent` field, which includes the fees. Reported-by: Rusty Russell <@rustyrussell>
This commit is contained in:
committed by
Rusty Russell
parent
1da977a04c
commit
d7cca0781d
@@ -1179,6 +1179,7 @@ static struct command_result *json_sendonion(struct command *cmd,
|
||||
struct lightningd *ld = cmd->ld;
|
||||
const char *label, *b11str;
|
||||
struct secret *path_secrets;
|
||||
struct amount_msat *msat;
|
||||
u64 *partid;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
@@ -1189,6 +1190,7 @@ static struct command_result *json_sendonion(struct command *cmd,
|
||||
p_opt("shared_secrets", param_secrets_array, &path_secrets),
|
||||
p_opt_def("partid", param_u64, &partid, 0),
|
||||
p_opt("bolt11", param_string, &b11str),
|
||||
p_opt_def("msatoshi", param_msat, &msat, AMOUNT_MSAT(0)),
|
||||
NULL))
|
||||
return command_param_failed();
|
||||
|
||||
@@ -1201,7 +1203,7 @@ static struct command_result *json_sendonion(struct command *cmd,
|
||||
failcode);
|
||||
|
||||
return send_payment_core(ld, cmd, payment_hash, *partid,
|
||||
first_hop, AMOUNT_MSAT(0), AMOUNT_MSAT(0),
|
||||
first_hop, *msat, AMOUNT_MSAT(0),
|
||||
label, b11str, &packet, NULL, NULL, NULL,
|
||||
path_secrets);
|
||||
}
|
||||
|
||||
@@ -1029,6 +1029,7 @@ static struct command_result *payment_createonion_success(struct command *cmd,
|
||||
json_object_end(req->js);
|
||||
|
||||
json_add_sha256(req->js, "payment_hash", p->payment_hash);
|
||||
json_add_amount_msat_only(req->js, "msatoshi", p->amount);
|
||||
|
||||
json_array_start(req->js, "shared_secrets");
|
||||
secrets = p->createonion_response->shared_secrets;
|
||||
|
||||
Reference in New Issue
Block a user