lightningd: remove msatoshi alias for amount_msat.

Changelog-Removed: JSON-RPC: `invoice`, `sendonion`, `sendpay`, `pay`, `keysend`, `fetchinvoice`, `sendinvoice`: `msatoshi` argument (deprecated 0.12.0). Use `amount_msat`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-01-25 10:58:48 +10:30
parent 0946a5ac35
commit 5ef4779edc
8 changed files with 11 additions and 32 deletions

View File

@ -1152,7 +1152,7 @@ static struct command_result *json_invoice(struct command *cmd,
info->cmd = cmd;
if (!param_check(cmd, buffer, params,
p_req("amount_msat|msatoshi", param_positive_msat_or_any, &msatoshi_val),
p_req("amount_msat", param_positive_msat_or_any, &msatoshi_val),
p_req("label", param_label, &info->label),
p_req("description", param_escaped_string, &desc_val),
p_opt_def("expiry", param_u64, &expiry, 3600*24*7),
@ -1980,7 +1980,7 @@ static struct command_result *json_preapprovekeysend(struct command *cmd,
if (!param(cmd, buffer, params,
p_req("destination", param_node_id, &destination),
p_req("payment_hash", param_sha256, &payment_hash),
p_req("amount_msat|msatoshi", param_msat, &amount),
p_req("amount_msat", param_msat, &amount),
NULL))
return command_param_failed();

View File

@ -1310,7 +1310,7 @@ static struct command_result *json_sendonion(struct command *cmd,
p_opt_def("partid", param_u64, &partid, 0),
/* FIXME: parameter should be invstring now */
p_opt("bolt11", param_invstring, &invstring),
p_opt_def("amount_msat|msatoshi", param_msat, &msat, AMOUNT_MSAT(0)),
p_opt_def("amount_msat", param_msat, &msat, AMOUNT_MSAT(0)),
p_opt("destination", param_node_id, &destination),
p_opt("localinvreqid", param_sha256, &local_invreq_id),
p_opt("groupid", param_u64, &group),
@ -1393,8 +1393,7 @@ static struct command_result *param_route_hops(struct command *cmd,
int *ignored;
if (!param(cmd, buffer, t,
/* deprecated: getroute gives both, so we allow both! */
p_req_dup_ok("amount_msat|msatoshi", param_msat, &amount_msat),
p_req("amount_msat", param_msat, &amount_msat),
p_req("id", param_node_id, &id),
p_req("delay", param_number, &delay),
p_req("channel", param_short_channel_id, &channel),
@ -1526,7 +1525,7 @@ static struct command_result *json_sendpay(struct command *cmd,
p_req("route", param_route_hops, &route),
p_req("payment_hash", param_sha256, &rhash),
p_opt("label", param_escaped_string, &label),
p_opt("amount_msat|msatoshi", param_msat, &msat),
p_opt("amount_msat", param_msat, &msat),
/* FIXME: parameter should be invstring now */
p_opt("bolt11", param_invstring, &invstring),
p_opt("payment_secret", param_secret, &payment_secret),

View File

@ -913,7 +913,7 @@ static struct command_result *json_fetchinvoice(struct command *cmd,
if (!param(cmd, buffer, params,
p_req("offer", param_offer, &sent->offer),
p_opt("amount_msat|msatoshi", param_msat, &msat),
p_opt("amount_msat", param_msat, &msat),
p_opt("quantity", param_u64, &quantity),
p_opt("recurrence_counter", param_number, &recurrence_counter),
p_opt("recurrence_start", param_number, &recurrence_start),

View File

@ -255,7 +255,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
if (!param(cmd, buf, params,
p_req("destination", param_node_id, &destination),
p_req("amount_msat|msatoshi", param_msat, &msat),
p_req("amount_msat", param_msat, &msat),
p_opt("label", param_string, &label),
p_opt_def("maxfeepercent", param_millionths,
&maxfee_pct_millionths, 500000),

View File

@ -1038,7 +1038,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_invstring, &b11str),
p_opt("amount_msat|msatoshi", param_msat, &msat),
p_opt("amount_msat", param_msat, &msat),
p_opt("label", param_string, &label),
p_opt_def("riskfactor", param_millionths,
&riskfactor_millionths, 10000000),

View File

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

View File

@ -266,8 +266,8 @@ def test_cln_plugin_reentrant(node_factory, executor):
# Now create two invoices, and pay them both. Neither should
# succeed, but we should queue them on the plugin.
i1 = l1.rpc.invoice(label='lbl1', msatoshi='42sat', description='desc')['bolt11']
i2 = l1.rpc.invoice(label='lbl2', msatoshi='31337sat', description='desc')['bolt11']
i1 = l1.rpc.invoice(label='lbl1', amount_msat='42sat', description='desc')['bolt11']
i2 = l1.rpc.invoice(label='lbl2', amount_msat='31337sat', description='desc')['bolt11']
f1 = executor.submit(l2.rpc.pay, i1)
f2 = executor.submit(l2.rpc.pay, i2)

View File

@ -5131,26 +5131,6 @@ def test_pay_middle_fail(node_factory, bitcoind, executor):
l1.rpc.waitsendpay('00' * 32)
def test_sendpay_dual_amounts(node_factory):
"""Test that handing *both* msatoshi and amount_msat to sendpay works"""
l1 = node_factory.get_node(options={'allow-deprecated-apis': True})
route = [{'amount_msat': 1011,
'msatoshi': 1011,
'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59',
'delay': 20,
'channel': '1x1x1'},
{'amount_msat': 1000,
'msatoshi': 1000,
'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d',
'delay': 10,
'channel': '2x2x2'}]
l1.rpc.check("sendpay", route=route, payment_hash="00" * 32)
with pytest.raises(RpcError, match=r'No connection to first peer found'):
l1.rpc.sendpay(route=route, payment_hash="00" * 32)
@unittest.skipIf(TEST_NETWORK != 'regtest', "Invoice is network specific")
@pytest.mark.slow_test
def test_payerkey(node_factory):