lightningd: change msatoshi args to amount_msat.

This is consistent with our output changes, and increases consistency.
It also keeps future sanity checks happy, that we only use JSON msat
helpers with '_msat' fields.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `invoice`, `sendonion`, `sendpay`, `pay`, `keysend`, `fetchinvoice`, `sendinvoice`: `msatoshi` argument is now called `amount_msat` to match other fields.
Changelog-Deprecated: JSON-RPC: `invoice`, `sendonion`, `sendpay`, `pay`, `keysend`, `fetchinvoice`, `sendinvoice` `msatoshi` (use `amount_msat`)
This commit is contained in:
Rusty Russell
2022-06-19 16:50:11 +09:30
parent ca69e293d1
commit cd7e784d6f
25 changed files with 192 additions and 154 deletions

View File

@@ -1233,7 +1233,7 @@ static struct command_result *json_fetchinvoice(struct command *cmd,
invreq = tlv_invoice_request_new(sent);
if (!param(cmd, buffer, params,
p_req("offer", param_offer, &sent->offer),
p_opt("msatoshi", param_msat, &msat),
p_opt("amount_msat|msatoshi", param_msat, &msat),
p_opt("quantity", param_u64, &invreq->quantity),
p_opt("recurrence_counter", param_number,
&invreq->recurrence_counter),
@@ -1647,7 +1647,7 @@ static struct command_result *json_sendinvoice(struct command *cmd,
if (!param(cmd, buffer, params,
p_req("offer", param_offer, &sent->offer),
p_req("label", param_label, &sent->inv_label),
p_opt("msatoshi", param_msat, &msat),
p_opt("amount_msat|msatoshi", param_msat, &msat),
p_opt_def("timeout", param_number, &timeout, 90),
p_opt("quantity", param_u64, &sent->inv->quantity),
NULL))

View File

@@ -155,7 +155,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
#endif
if (!param(cmd, buf, params,
p_req("destination", param_node_id, &destination),
p_req("msatoshi", param_msat, &msat),
p_req("amount_msat|msatoshi", param_msat, &msat),
p_opt("label", param_string, &label),
p_opt_def("maxfeepercent", param_millionths,
&maxfee_pct_millionths, 500000),
@@ -460,7 +460,7 @@ static struct command_result *htlc_accepted_call(struct command *cmd,
ki);
plugin_log(cmd->plugin, LOG_INFORM, "Inserting a new invoice for keysend with payment_hash %s", type_to_string(tmpctx, struct sha256, &payment_hash));
json_add_string(req->js, "msatoshi", "any");
json_add_string(req->js, "amount_msat", "any");
json_add_string(req->js, "label", ki->label);
json_add_string(req->js, "description", "Spontaneous incoming payment through keysend");
json_add_preimage(req->js, "preimage", &ki->payment_preimage);

View File

@@ -1554,7 +1554,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_add_amount_msat_only(req->js, "amount_msat", p->amount);
json_array_start(req->js, "shared_secrets");
secrets = p->createonion_response->shared_secrets;

View File

@@ -957,7 +957,7 @@ static struct command_result *json_pay(struct command *cmd,
if (!param(cmd, buf, params,
/* FIXME: parameter should be invstring now */
p_req("bolt11", param_string, &b11str),
p_opt("msatoshi", param_msat, &msat),
p_opt("amount_msat|msatoshi", param_msat, &msat),
p_opt("label", param_string, &label),
p_opt_def("riskfactor", param_millionths,
&riskfactor_millionths, 10000000),

View File

@@ -130,7 +130,7 @@ static struct command_result *json_getroute(struct command *cmd,
if (!param(cmd, buffer, params,
p_req("id", param_node_id, &destination),
p_req("msatoshi", param_msat, &msat),
p_req("amount_msat|msatoshi", param_msat, &msat),
p_req("riskfactor", param_millionths, &riskfactor_millionths),
p_opt_def("cltv", param_number, &cltv, 9),
p_opt_def("fromid", param_node_id, &source, local_id),