mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
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:
parent
ca69e293d1
commit
cd7e784d6f
@ -443,6 +443,7 @@
|
||||
"Getinfo.warning_lightningd_sync": 17
|
||||
},
|
||||
"GetrouteRequest": {
|
||||
"GetRoute.amount_msat": 9,
|
||||
"GetRoute.cltv": 4,
|
||||
"GetRoute.exclude[]": 7,
|
||||
"GetRoute.fromid": 5,
|
||||
@ -464,6 +465,7 @@
|
||||
"GetRoute.route[].style": 6
|
||||
},
|
||||
"InvoiceRequest": {
|
||||
"Invoice.amount_msat": 10,
|
||||
"Invoice.cltv": 6,
|
||||
"Invoice.deschashonly": 9,
|
||||
"Invoice.description": 2,
|
||||
@ -486,6 +488,7 @@
|
||||
"Invoice.warning_private_unused": 8
|
||||
},
|
||||
"KeysendRequest": {
|
||||
"KeySend.amount_msat": 10,
|
||||
"KeySend.destination": 1,
|
||||
"KeySend.exemptfee": 7,
|
||||
"KeySend.extratlvs": 9,
|
||||
@ -821,6 +824,7 @@
|
||||
"NewAddr.p2sh-segwit": 2
|
||||
},
|
||||
"PayRequest": {
|
||||
"Pay.amount_msat": 13,
|
||||
"Pay.bolt11": 1,
|
||||
"Pay.description": 12,
|
||||
"Pay.exclude": 10,
|
||||
@ -859,6 +863,7 @@
|
||||
"SendOnion.first_hop.id": 1
|
||||
},
|
||||
"SendonionRequest": {
|
||||
"SendOnion.amount_msat": 12,
|
||||
"SendOnion.bolt11": 7,
|
||||
"SendOnion.destination": 9,
|
||||
"SendOnion.first_hop": 2,
|
||||
@ -887,6 +892,7 @@
|
||||
"SendOnion.status": 3
|
||||
},
|
||||
"SendpayRequest": {
|
||||
"SendPay.amount_msat": 10,
|
||||
"SendPay.bolt11": 5,
|
||||
"SendPay.groupid": 9,
|
||||
"SendPay.label": 3,
|
||||
@ -914,6 +920,7 @@
|
||||
"SendPay.status": 4
|
||||
},
|
||||
"SendpayRoute": {
|
||||
"SendPay.route[].amount_msat": 5,
|
||||
"SendPay.route[].channel": 4,
|
||||
"SendPay.route[].delay": 3,
|
||||
"SendPay.route[].id": 2,
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -615,7 +615,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
"""
|
||||
return self.call("dev-memleak")
|
||||
|
||||
def dev_pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
|
||||
def dev_pay(self, bolt11, amount_msat=None, label=None, riskfactor=None,
|
||||
maxfeepercent=None, retry_for=None,
|
||||
maxdelay=None, exemptfee=None, use_shadow=True, exclude=None):
|
||||
"""
|
||||
@ -624,7 +624,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
"""
|
||||
payload = {
|
||||
"bolt11": bolt11,
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"label": label,
|
||||
"riskfactor": riskfactor,
|
||||
"maxfeepercent": maxfeepercent,
|
||||
@ -797,19 +797,26 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
res = self.call("listpeers", payload)
|
||||
return res.get("peers") and res["peers"][0] or None
|
||||
|
||||
def getroute(self, node_id, msatoshi, riskfactor, cltv=9, fromid=None,
|
||||
fuzzpercent=None, exclude=None, maxhops=None):
|
||||
def getroute(self, node_id, amount_msat=None, riskfactor=None, cltv=9, fromid=None,
|
||||
fuzzpercent=None, exclude=None, maxhops=None, msatoshi=None):
|
||||
"""
|
||||
Show route to {id} for {msatoshi}, using {riskfactor} and optional
|
||||
Show route to {id} for {amount_msat}, using {riskfactor} and optional
|
||||
{cltv} (default 9). If specified search from {fromid} otherwise use
|
||||
this node as source. Randomize the route with up to {fuzzpercent}
|
||||
(0.0 -> 100.0, default 5.0). {exclude} is an optional array of
|
||||
scid/direction or node-id to exclude. Limit the number of hops in the
|
||||
route to {maxhops}.
|
||||
"""
|
||||
if msatoshi:
|
||||
amount_msat = msatoshi
|
||||
if riskfactor is None:
|
||||
raise TypeError("getroute() missing 'riskfactor'")
|
||||
if amount_msat is None:
|
||||
raise TypeError("getroute() missing 'amount_msat'")
|
||||
|
||||
payload = {
|
||||
"id": node_id,
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"riskfactor": riskfactor,
|
||||
"cltv": cltv,
|
||||
"fromid": fromid,
|
||||
@ -828,14 +835,22 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
}
|
||||
return self.call("help", payload)
|
||||
|
||||
def invoice(self, msatoshi, label, description, expiry=None, fallbacks=None,
|
||||
preimage=None, exposeprivatechannels=None, cltv=None, deschashonly=None):
|
||||
def invoice(self, amount_msat=None, label=None, description=None, expiry=None, fallbacks=None,
|
||||
preimage=None, exposeprivatechannels=None, cltv=None, deschashonly=None, msatoshi=None):
|
||||
"""
|
||||
Create an invoice for {msatoshi} with {label} and {description} with
|
||||
Create an invoice for {amount_msat} with {label} and {description} with
|
||||
optional {expiry} seconds (default 1 week).
|
||||
"""
|
||||
if msatoshi:
|
||||
amount_msat = msatoshi
|
||||
if label is None:
|
||||
raise TypeError("invoice() missing 'label'")
|
||||
if description is None:
|
||||
raise TypeError("invoice() missing 'description'")
|
||||
if amount_msat is None:
|
||||
raise TypeError("invoice() missing 'amount_msat'")
|
||||
payload = {
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"label": label,
|
||||
"description": description,
|
||||
"expiry": expiry,
|
||||
@ -995,18 +1010,21 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
"""
|
||||
return self.call("newaddr", {"addresstype": addresstype})
|
||||
|
||||
def pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
|
||||
def pay(self, bolt11, amount_msat=None, label=None, riskfactor=None,
|
||||
maxfeepercent=None, retry_for=None,
|
||||
maxdelay=None, exemptfee=None, localofferid=None, exclude=None,
|
||||
maxfee=None, description=None):
|
||||
maxfee=None, description=None, msatoshi=None):
|
||||
"""
|
||||
Send payment specified by {bolt11} with {msatoshi}
|
||||
Send payment specified by {bolt11} with {amount_msat}
|
||||
(ignored if {bolt11} has an amount), optional {label}
|
||||
and {riskfactor} (default 1.0).
|
||||
"""
|
||||
# Deprecated usage
|
||||
if msatoshi:
|
||||
amount_msat = msatoshi
|
||||
payload = {
|
||||
"bolt11": bolt11,
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"label": label,
|
||||
"riskfactor": riskfactor,
|
||||
"maxfeepercent": maxfeepercent,
|
||||
@ -1132,15 +1150,18 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
}
|
||||
return self.call("plugin", payload)
|
||||
|
||||
def sendpay(self, route, payment_hash, label=None, msatoshi=None, bolt11=None, payment_secret=None, partid=None, groupid=None, payment_metadata=None):
|
||||
def sendpay(self, route, payment_hash, label=None, amount_msat=None, bolt11=None, payment_secret=None, partid=None, groupid=None, payment_metadata=None, msatoshi=None):
|
||||
"""
|
||||
Send along {route} in return for preimage of {payment_hash}.
|
||||
"""
|
||||
# Deprecated usage
|
||||
if msatoshi:
|
||||
amount_msat = msatoshi
|
||||
payload = {
|
||||
"route": route,
|
||||
"payment_hash": payment_hash,
|
||||
"label": label,
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"bolt11": bolt11,
|
||||
"payment_secret": payment_secret,
|
||||
"partid": partid,
|
||||
@ -1151,8 +1172,8 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
|
||||
def sendonion(
|
||||
self, onion, first_hop, payment_hash, label=None,
|
||||
shared_secrets=None, partid=None, bolt11=None, msatoshi=None,
|
||||
destination=None
|
||||
shared_secrets=None, partid=None, bolt11=None, amount_msat=None,
|
||||
destination=None, msatoshi=None
|
||||
):
|
||||
"""Send an outgoing payment using the specified onion.
|
||||
|
||||
@ -1161,6 +1182,9 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
internal handling, but not required.
|
||||
|
||||
"""
|
||||
# Deprecated usage
|
||||
if msatoshi:
|
||||
amount_msat = msatoshi
|
||||
payload = {
|
||||
"onion": onion,
|
||||
"first_hop": first_hop,
|
||||
@ -1169,7 +1193,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
"shared_secrets": shared_secrets,
|
||||
"partid": partid,
|
||||
"bolt11": bolt11,
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"destination": destination,
|
||||
}
|
||||
return self.call("sendonion", payload)
|
||||
@ -1428,11 +1452,16 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
payload.update({k: v for k, v in kwargs.items()})
|
||||
return self.call("getsharedsecret", payload)
|
||||
|
||||
def keysend(self, destination, msatoshi, label=None, maxfeepercent=None,
|
||||
def keysend(self, destination, amount_msat=None, label=None, maxfeepercent=None,
|
||||
retry_for=None, maxdelay=None, exemptfee=None,
|
||||
extratlvs=None):
|
||||
extratlvs=None, msatoshi=None):
|
||||
"""
|
||||
"""
|
||||
# Deprecated usage
|
||||
if msatoshi:
|
||||
amount_msat = msatoshi
|
||||
if amount_msat is None:
|
||||
raise TypeError("keysend() missing 'amount_msat'")
|
||||
|
||||
if extratlvs is not None and not isinstance(extratlvs, dict):
|
||||
raise ValueError(
|
||||
@ -1441,7 +1470,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
|
||||
payload = {
|
||||
"destination": destination,
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"label": label,
|
||||
"maxfeepercent": maxfeepercent,
|
||||
"retry_for": retry_for,
|
||||
|
@ -1152,23 +1152,23 @@ class LightningNode(object):
|
||||
except RpcError:
|
||||
return None
|
||||
|
||||
def dev_pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
|
||||
def dev_pay(self, bolt11, amount_msat=None, label=None, riskfactor=None,
|
||||
maxfeepercent=None, retry_for=None,
|
||||
maxdelay=None, exemptfee=None, use_shadow=True, exclude=[]):
|
||||
"""Wrapper for rpc.dev_pay which suppresses the request schema"""
|
||||
# FIXME? dev options are not in schema
|
||||
old_check = self.rpc.check_request_schemas
|
||||
self.rpc.check_request_schemas = False
|
||||
ret = self.rpc.dev_pay(bolt11, msatoshi, label, riskfactor,
|
||||
ret = self.rpc.dev_pay(bolt11, amount_msat, label, riskfactor,
|
||||
maxfeepercent, retry_for,
|
||||
maxdelay, exemptfee, use_shadow, exclude)
|
||||
self.rpc.check_request_schemas = old_check
|
||||
return ret
|
||||
|
||||
def dev_invoice(self, msatoshi, label, description, expiry=None, fallbacks=None, preimage=None, exposeprivatechannels=None, cltv=None, dev_routes=None):
|
||||
def dev_invoice(self, amount_msat, label, description, expiry=None, fallbacks=None, preimage=None, exposeprivatechannels=None, cltv=None, dev_routes=None):
|
||||
"""Wrapper for rpc.invoice() with dev-routes option"""
|
||||
payload = {
|
||||
"msatoshi": msatoshi,
|
||||
"amount_msat": amount_msat,
|
||||
"label": label,
|
||||
"description": description,
|
||||
"expiry": expiry,
|
||||
|
@ -3,7 +3,7 @@
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"msatoshi",
|
||||
"amount_msat",
|
||||
"riskfactor"
|
||||
],
|
||||
"properties": {
|
||||
@ -11,7 +11,7 @@
|
||||
"type": "pubkey",
|
||||
"description": ""
|
||||
},
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat",
|
||||
"description": ""
|
||||
},
|
||||
|
@ -3,12 +3,12 @@
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"msatoshi",
|
||||
"amount_msat",
|
||||
"label",
|
||||
"description"
|
||||
],
|
||||
"properties": {
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat_or_any",
|
||||
"description": ""
|
||||
},
|
||||
|
@ -4,13 +4,13 @@
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"destination",
|
||||
"msatoshi"
|
||||
"amount_msat"
|
||||
],
|
||||
"properties": {
|
||||
"destination": {
|
||||
"type": "pubkey"
|
||||
},
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat"
|
||||
},
|
||||
"label": {
|
||||
|
@ -9,7 +9,7 @@
|
||||
"bolt11": {
|
||||
"type": "string"
|
||||
},
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat"
|
||||
},
|
||||
"label": {
|
||||
|
@ -48,7 +48,7 @@
|
||||
"bolt11": {
|
||||
"type": "string"
|
||||
},
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat"
|
||||
},
|
||||
"destination": {
|
||||
|
@ -12,15 +12,17 @@
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"msatoshi",
|
||||
"id",
|
||||
"delay",
|
||||
"channel"
|
||||
],
|
||||
"properties": {
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat"
|
||||
},
|
||||
"msatoshi": {
|
||||
"deprecated": "true"
|
||||
},
|
||||
"id": {
|
||||
"type": "pubkey"
|
||||
},
|
||||
@ -39,7 +41,7 @@
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"msatoshi": {
|
||||
"amount_msat": {
|
||||
"type": "msat"
|
||||
},
|
||||
"bolt11": {
|
||||
|
@ -1147,7 +1147,7 @@ static struct command_result *json_invoice(struct command *cmd,
|
||||
info->cmd = cmd;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
p_req("msatoshi", param_positive_msat_or_any, &msatoshi_val),
|
||||
p_req("amount_msat|msatoshi", 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_time, &expiry, 3600*24*7),
|
||||
|
@ -1289,7 +1289,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_string, &invstring),
|
||||
p_opt_def("msatoshi", param_msat, &msat, AMOUNT_MSAT(0)),
|
||||
p_opt_def("amount_msat|msatoshi", param_msat, &msat, AMOUNT_MSAT(0)),
|
||||
p_opt("destination", param_node_id, &destination),
|
||||
p_opt("localofferid", param_sha256, &local_offer_id),
|
||||
p_opt("groupid", param_u64, &group),
|
||||
@ -1441,7 +1441,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("msatoshi", param_msat, &msat),
|
||||
p_opt("amount_msat|msatoshi", param_msat, &msat),
|
||||
/* FIXME: parameter should be invstring now */
|
||||
p_opt("bolt11", param_string, &invstring),
|
||||
p_opt("payment_secret", param_secret, &payment_secret),
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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),
|
||||
|
@ -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),
|
||||
|
@ -104,7 +104,7 @@ def test_grpc_connect(node_factory):
|
||||
print(response)
|
||||
|
||||
inv = stub.Invoice(nodepb.InvoiceRequest(
|
||||
msatoshi=AmountOrAny(any=True),
|
||||
amount_msat=AmountOrAny(any=True),
|
||||
description="hello",
|
||||
label="lbl1",
|
||||
preimage=b"\x00" * 32,
|
||||
@ -119,7 +119,7 @@ def test_grpc_connect(node_factory):
|
||||
with pytest.raises(Exception, match=r'Duplicate label'):
|
||||
# This request creates a label collision
|
||||
stub.Invoice(nodepb.InvoiceRequest(
|
||||
msatoshi=AmountOrAny(amount=Amount(msat=12345)),
|
||||
amount_msat=AmountOrAny(amount=Amount(msat=12345)),
|
||||
description="hello",
|
||||
label="lbl1",
|
||||
))
|
||||
|
@ -2735,10 +2735,10 @@ def setup_multihtlc_test(node_factory, bitcoind):
|
||||
nodes[-1].rpc.dev_ignore_htlcs(id=nodes[-2].info['id'], ignore=True)
|
||||
|
||||
preimage = "0" * 64
|
||||
inv = nodes[0].rpc.invoice(msatoshi=10**8, label='x', description='desc',
|
||||
inv = nodes[0].rpc.invoice(amount_msat=10**8, label='x', description='desc',
|
||||
preimage=preimage)
|
||||
h = inv['payment_hash']
|
||||
nodes[-1].rpc.invoice(msatoshi=10**8, label='x', description='desc',
|
||||
nodes[-1].rpc.invoice(amount_msat=10**8, label='x', description='desc',
|
||||
preimage=preimage)['payment_hash']
|
||||
|
||||
# First, the failed attempts (paying wrong node). CLTV1
|
||||
@ -3641,8 +3641,8 @@ We send an HTLC, and peer unilaterally closes: do we close upstream?
|
||||
'dev-no-ping-timer': None},
|
||||
{'dev-no-ping-timer': None}])
|
||||
|
||||
ph1 = l3.rpc.invoice(msatoshi="10000sat", label='x1', description='desc2')['payment_hash']
|
||||
ph2 = l3.rpc.invoice(msatoshi="10000sat", label='x2', description='desc2')['payment_hash']
|
||||
ph1 = l3.rpc.invoice(amount_msat="10000sat", label='x1', description='desc2')['payment_hash']
|
||||
ph2 = l3.rpc.invoice(amount_msat="10000sat", label='x2', description='desc2')['payment_hash']
|
||||
|
||||
route = l1.rpc.getroute(l3.info['id'], 1, 1)['route']
|
||||
|
||||
|
@ -132,7 +132,7 @@ def test_invoice_preimage(node_factory):
|
||||
invoice_preimage = "17b08f669513b7379728fc1abcea5eaf3448bc1eba55a68ca2cd1843409cdc04"
|
||||
|
||||
# Make invoice and pay it
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv", description="?", preimage=invoice_preimage)
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv", description="?", preimage=invoice_preimage)
|
||||
payment = l1.rpc.pay(inv['bolt11'])
|
||||
|
||||
# Check preimage was given.
|
||||
@ -153,7 +153,7 @@ def test_invoice_routeboost(node_factory, bitcoind):
|
||||
|
||||
# Check routeboost.
|
||||
# Make invoice and pay it
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv1", description="?")
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv1", description="?")
|
||||
# Check routeboost.
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
@ -173,7 +173,7 @@ def test_invoice_routeboost(node_factory, bitcoind):
|
||||
wait_channel_quiescent(l1, l2)
|
||||
|
||||
# Due to reserve & fees, l1 doesn't have capacity to pay this.
|
||||
inv = l2.rpc.invoice(msatoshi=2 * (10**8) - 123456, label="inv2", description="?")
|
||||
inv = l2.rpc.invoice(amount_msat=2 * (10**8) - 123456, label="inv2", description="?")
|
||||
# Check warning
|
||||
assert 'warning_capacity' in inv
|
||||
assert 'warning_private_unused' not in inv
|
||||
@ -228,7 +228,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
|
||||
# Since there's only one route, it will reluctantly hint that even
|
||||
# though it's private
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv0", description="?")
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv0", description="?")
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -243,7 +243,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert r['cltv_expiry_delta'] == 6
|
||||
|
||||
# If we explicitly say not to, it won't expose.
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv1", description="?", exposeprivatechannels=False)
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv1", description="?", exposeprivatechannels=False)
|
||||
assert 'warning_private_unused' in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -252,7 +252,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert 'routes' not in l1.rpc.decodepay(inv['bolt11'])
|
||||
|
||||
# If we ask for it, we get it.
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv1a", description="?", exposeprivatechannels=scid)
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv1a", description="?", exposeprivatechannels=scid)
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -267,7 +267,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert r['cltv_expiry_delta'] == 6
|
||||
|
||||
# Similarly if we ask for an array.
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv1b", description="?", exposeprivatechannels=[scid])
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv1b", description="?", exposeprivatechannels=[scid])
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -290,7 +290,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
# Make sure channel is totally public.
|
||||
wait_for(lambda: [c['public'] for c in l2.rpc.listchannels(scid2)['channels']] == [True, True])
|
||||
|
||||
inv = l2.rpc.invoice(msatoshi=10**7, label="inv2", description="?")
|
||||
inv = l2.rpc.invoice(amount_msat=10**7, label="inv2", description="?")
|
||||
print(inv)
|
||||
assert 'warning_deadends' in inv
|
||||
assert 'warning_private_unused' not in inv
|
||||
@ -299,7 +299,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert 'warning_mpp' not in inv
|
||||
|
||||
# Unless we tell it to include it.
|
||||
inv = l2.rpc.invoice(msatoshi=10**7, label="inv3", description="?", exposeprivatechannels=True)
|
||||
inv = l2.rpc.invoice(amount_msat=10**7, label="inv3", description="?", exposeprivatechannels=True)
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -313,7 +313,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert r['fee_proportional_millionths'] == 10
|
||||
assert r['cltv_expiry_delta'] == 6
|
||||
|
||||
inv = l2.rpc.invoice(msatoshi=10**7, label="inv4", description="?", exposeprivatechannels=scid)
|
||||
inv = l2.rpc.invoice(amount_msat=10**7, label="inv4", description="?", exposeprivatechannels=scid)
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -328,7 +328,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert r['cltv_expiry_delta'] == 6
|
||||
|
||||
# Ask it explicitly to use a channel it can't (insufficient capacity)
|
||||
inv = l2.rpc.invoice(msatoshi=(10**5) * 1000 + 1, label="inv5", description="?", exposeprivatechannels=scid2)
|
||||
inv = l2.rpc.invoice(amount_msat=(10**5) * 1000 + 1, label="inv5", description="?", exposeprivatechannels=scid2)
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_deadends' not in inv
|
||||
assert 'warning_capacity' in inv
|
||||
@ -336,7 +336,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
assert 'warning_mpp' not in inv
|
||||
|
||||
# Give it two options and it will pick one with suff capacity.
|
||||
inv = l2.rpc.invoice(msatoshi=(10**5) * 1000 + 1, label="inv6", description="?", exposeprivatechannels=[scid2, scid])
|
||||
inv = l2.rpc.invoice(amount_msat=(10**5) * 1000 + 1, label="inv6", description="?", exposeprivatechannels=[scid2, scid])
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -356,7 +356,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: l2.rpc.listchannels(scid_dummy)['channels'] == [])
|
||||
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv7", description="?", exposeprivatechannels=scid)
|
||||
inv = l2.rpc.invoice(amount_msat=123456, label="inv7", description="?", exposeprivatechannels=scid)
|
||||
assert 'warning_private_unused' not in inv
|
||||
assert 'warning_capacity' not in inv
|
||||
assert 'warning_offline' not in inv
|
||||
@ -374,7 +374,7 @@ def test_invoice_routeboost_private(node_factory, bitcoind):
|
||||
def test_invoice_expiry(node_factory, executor):
|
||||
l1, l2 = node_factory.line_graph(2, fundchannel=True)
|
||||
|
||||
inv = l2.rpc.invoice(msatoshi=123000, label='test_pay', description='description', expiry=1)['bolt11']
|
||||
inv = l2.rpc.invoice(amount_msat=123000, label='test_pay', description='description', expiry=1)['bolt11']
|
||||
time.sleep(2)
|
||||
|
||||
with pytest.raises(RpcError):
|
||||
@ -438,7 +438,7 @@ def test_invoice_expiry(node_factory, executor):
|
||||
assert len(l2.rpc.listinvoices()['invoices']) == 0
|
||||
|
||||
start = int(time.time())
|
||||
inv = l2.rpc.invoice(msatoshi=123000, label='inv_s', description='description', expiry=1)['bolt11']
|
||||
inv = l2.rpc.invoice(amount_msat=123000, label='inv_s', description='description', expiry=1)['bolt11']
|
||||
end = int(time.time())
|
||||
expiry = only_one(l2.rpc.listinvoices('inv_s')['invoices'])['expires_at']
|
||||
assert expiry >= start + 1 and expiry <= end + 1
|
||||
@ -562,8 +562,8 @@ def test_waitanyinvoice_reversed(node_factory, executor):
|
||||
def test_autocleaninvoice(node_factory):
|
||||
l1 = node_factory.get_node()
|
||||
|
||||
l1.rpc.invoice(msatoshi=12300, label='inv1', description='description1', expiry=4)
|
||||
l1.rpc.invoice(msatoshi=12300, label='inv2', description='description2', expiry=12)
|
||||
l1.rpc.invoice(amount_msat=12300, label='inv1', description='description1', expiry=4)
|
||||
l1.rpc.invoice(amount_msat=12300, label='inv2', description='description2', expiry=12)
|
||||
l1.rpc.autocleaninvoice(cycle_seconds=8, expired_by=2)
|
||||
start_time = time.time()
|
||||
|
||||
@ -633,7 +633,7 @@ def test_amountless_invoice(node_factory):
|
||||
details = l1.rpc.decodepay(inv)
|
||||
assert('msatoshi' not in details)
|
||||
|
||||
l1.rpc.pay(inv, msatoshi=1337)
|
||||
l1.rpc.pay(inv, amount_msat=1337)
|
||||
|
||||
i = l2.rpc.listinvoices()['invoices']
|
||||
assert(len(i) == 1)
|
||||
|
@ -2074,7 +2074,7 @@ def test_unicode_rpc(node_factory, executor, bitcoind):
|
||||
node = node_factory.get_node()
|
||||
desc = "Some candy 🍬 and a nice glass of milk 🥛."
|
||||
|
||||
node.rpc.invoice(msatoshi=42, label=desc, description=desc)
|
||||
node.rpc.invoice(amount_msat=42, label=desc, description=desc)
|
||||
invoices = node.rpc.listinvoices()['invoices']
|
||||
assert(len(invoices) == 1)
|
||||
assert(invoices[0]['description'] == desc)
|
||||
|
@ -102,7 +102,7 @@ def test_pay_limits(node_factory):
|
||||
# Fee too high.
|
||||
err = r'Fee exceeds our fee budget: [1-9]msat > 0msat, discarding route'
|
||||
with pytest.raises(RpcError, match=err) as err:
|
||||
l1.rpc.call('pay', {'bolt11': inv['bolt11'], 'msatoshi': 100000, 'maxfeepercent': 0.0001, 'exemptfee': 0})
|
||||
l1.rpc.call('pay', {'bolt11': inv['bolt11'], 'amount_msat': 100000, 'maxfeepercent': 0.0001, 'exemptfee': 0})
|
||||
|
||||
assert err.value.error['code'] == PAY_STOPPED_RETRYING
|
||||
|
||||
@ -119,7 +119,7 @@ def test_pay_limits(node_factory):
|
||||
failmsg = r'CLTV delay exceeds our CLTV budget'
|
||||
# Delay too high.
|
||||
with pytest.raises(RpcError, match=failmsg) as err:
|
||||
l1.rpc.call('pay', {'bolt11': inv['bolt11'], 'msatoshi': 100000, 'maxdelay': 0})
|
||||
l1.rpc.call('pay', {'bolt11': inv['bolt11'], 'amount_msat': 100000, 'maxdelay': 0})
|
||||
|
||||
assert err.value.error['code'] == PAY_STOPPED_RETRYING
|
||||
# Should also have retried two more times.
|
||||
@ -131,10 +131,10 @@ def test_pay_limits(node_factory):
|
||||
# This fails!
|
||||
err = r'Fee exceeds our fee budget: 2msat > 1msat, discarding route'
|
||||
with pytest.raises(RpcError, match=err) as err:
|
||||
l1.rpc.pay(bolt11=inv['bolt11'], msatoshi=100000, maxfee=1)
|
||||
l1.rpc.pay(bolt11=inv['bolt11'], amount_msat=100000, maxfee=1)
|
||||
|
||||
# This works, because fee is less than exemptfee.
|
||||
l1.dev_pay(inv['bolt11'], msatoshi=100000, maxfeepercent=0.0001,
|
||||
l1.dev_pay(inv['bolt11'], amount_msat=100000, maxfeepercent=0.0001,
|
||||
exemptfee=2000, use_shadow=False)
|
||||
status = l1.rpc.call('paystatus', {'bolt11': inv['bolt11']})['pay'][3]['attempts']
|
||||
assert len(status) == 1
|
||||
@ -323,7 +323,7 @@ def test_pay_error_update_fees(node_factory):
|
||||
l1, l2, l3 = node_factory.line_graph(3, fundchannel=True, wait_for_announce=True)
|
||||
|
||||
# Don't include any routehints in first invoice.
|
||||
inv1 = l3.dev_invoice(msatoshi=123000,
|
||||
inv1 = l3.dev_invoice(amount_msat=123000,
|
||||
label='test_pay_error_update_fees',
|
||||
description='description',
|
||||
dev_routes=[])
|
||||
@ -369,7 +369,7 @@ def test_pay_optional_args(node_factory):
|
||||
# root of a payment tree with the bolt11 invoice).
|
||||
|
||||
anyinv = l2.rpc.invoice('any', 'any_pay', 'desc')['bolt11']
|
||||
l1.dev_pay(anyinv, label='desc', msatoshi=500, use_shadow=False)
|
||||
l1.dev_pay(anyinv, label='desc', amount_msat=500, use_shadow=False)
|
||||
payment3 = l1.rpc.listsendpays(anyinv)['payments']
|
||||
assert len(payment3) == 1
|
||||
assert payment3[0]['label'] == 'desc'
|
||||
@ -1628,7 +1628,7 @@ def test_htlcs_cltv_only_difference(node_factory, bitcoind):
|
||||
# l3 will see a reconnect from l4 when l4 restarts.
|
||||
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True, opts=[{}] * 2 + [{'dev-no-reconnect': None, 'may_reconnect': True}] * 2)
|
||||
|
||||
inv = l4.rpc.invoice(msatoshi=10**8, label='x', description='desc')
|
||||
inv = l4.rpc.invoice(amount_msat=10**8, label='x', description='desc')
|
||||
h = inv['payment_hash']
|
||||
l4.rpc.dev_ignore_htlcs(id=l3.info['id'], ignore=True)
|
||||
|
||||
@ -1850,7 +1850,7 @@ def test_pay_routeboost(node_factory, bitcoind):
|
||||
'fee_base_msat': 1000,
|
||||
'fee_proportional_millionths': 10,
|
||||
'cltv_expiry_delta': 6}]
|
||||
inv = l5.dev_invoice(msatoshi=10**5,
|
||||
inv = l5.dev_invoice(amount_msat=10**5,
|
||||
label='test_pay_routeboost2',
|
||||
description='test_pay_routeboost2',
|
||||
dev_routes=[routel3l4l5])
|
||||
@ -1872,7 +1872,7 @@ def test_pay_routeboost(node_factory, bitcoind):
|
||||
'fee_base_msat': 1000,
|
||||
'fee_proportional_millionths': 10,
|
||||
'cltv_expiry_delta': 6}]
|
||||
inv = l5.dev_invoice(msatoshi=10**5,
|
||||
inv = l5.dev_invoice(amount_msat=10**5,
|
||||
label='test_pay_routeboost5',
|
||||
description='test_pay_routeboost5',
|
||||
dev_routes=[routel3l4l5, routel3l5])
|
||||
@ -2171,7 +2171,7 @@ def test_setchannel_routing(node_factory, bitcoind):
|
||||
l1.rpc.getroute(l3.info['id'], 4001793, 1, fuzzpercent=0)["route"]
|
||||
|
||||
# We should consider this unroutable! (MPP is disabled!)
|
||||
inv = l3.dev_invoice(msatoshi=4001793,
|
||||
inv = l3.dev_invoice(amount_msat=4001793,
|
||||
label='test_setchannel_1',
|
||||
description='desc',
|
||||
dev_routes=[])
|
||||
@ -2237,7 +2237,7 @@ def test_setchannel_routing(node_factory, bitcoind):
|
||||
l1.rpc.waitsendpay(inv['payment_hash'])
|
||||
|
||||
# Check that this one warns about capacity!
|
||||
inv = l3.rpc.call('invoice', {'msatoshi': 4001793,
|
||||
inv = l3.rpc.call('invoice', {'amount_msat': 4001793,
|
||||
'label': 'test_setchannel_4',
|
||||
'description': 'desc'})
|
||||
assert 'warning_capacity' in inv
|
||||
@ -2730,7 +2730,7 @@ def test_tlv_or_legacy(node_factory, bitcoind):
|
||||
|
||||
# We need to force l3 to provide route hint from l2 (it won't normally,
|
||||
# since it sees l2 as a dead end).
|
||||
inv = l3.dev_invoice(msatoshi=10000,
|
||||
inv = l3.dev_invoice(amount_msat=10000,
|
||||
label="test_tlv1",
|
||||
description="test_tlv1",
|
||||
dev_routes=[[{'id': l2.info['id'],
|
||||
@ -3009,7 +3009,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r134,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=1,
|
||||
@ -3021,7 +3021,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=499,
|
||||
amount_msat=499,
|
||||
payment_secret=paysecret,
|
||||
groupid=1,
|
||||
)
|
||||
@ -3031,7 +3031,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=999,
|
||||
amount_msat=999,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=2,
|
||||
@ -3042,7 +3042,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=2,
|
||||
@ -3054,7 +3054,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=3,
|
||||
@ -3066,7 +3066,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=1,
|
||||
@ -3076,7 +3076,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r134,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=1,
|
||||
@ -3086,7 +3086,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=2,
|
||||
@ -3125,7 +3125,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
pay = l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=2,
|
||||
@ -3138,7 +3138,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
|
||||
l1.rpc.sendpay(
|
||||
route=r124,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=3,
|
||||
@ -3155,7 +3155,7 @@ def test_partial_payment_timeout(node_factory, bitcoind):
|
||||
l1.rpc.sendpay(
|
||||
route=route,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=1,
|
||||
@ -3175,7 +3175,7 @@ def test_partial_payment_timeout(node_factory, bitcoind):
|
||||
l1.rpc.sendpay(
|
||||
route=route,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=1,
|
||||
@ -3184,7 +3184,7 @@ def test_partial_payment_timeout(node_factory, bitcoind):
|
||||
l1.rpc.sendpay(
|
||||
route=route,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=2,
|
||||
@ -3210,7 +3210,7 @@ def test_partial_payment_restart(node_factory, bitcoind):
|
||||
l1.rpc.sendpay(
|
||||
route=route,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=1,
|
||||
@ -3228,7 +3228,7 @@ def test_partial_payment_restart(node_factory, bitcoind):
|
||||
l1.rpc.sendpay(
|
||||
route=route,
|
||||
payment_hash=inv['payment_hash'],
|
||||
msatoshi=1000,
|
||||
amount_msat=1000,
|
||||
bolt11=inv['bolt11'],
|
||||
payment_secret=paysecret,
|
||||
partid=2,
|
||||
@ -3253,7 +3253,7 @@ def test_partial_payment_htlc_loss(node_factory, bitcoind):
|
||||
|
||||
route = l1.rpc.getroute(l3.info['id'], 500, 1)['route']
|
||||
|
||||
l1.rpc.sendpay(route=route, payment_hash=inv['payment_hash'], msatoshi=1000, bolt11=inv['bolt11'], payment_secret=paysecret, partid=1)
|
||||
l1.rpc.sendpay(route=route, payment_hash=inv['payment_hash'], amount_msat=1000, bolt11=inv['bolt11'], payment_secret=paysecret, partid=1)
|
||||
|
||||
wait_for(lambda: not only_one(l2.rpc.listpeers(l3.info['id'])['peers'])['connected'])
|
||||
l2.rpc.dev_fail(l3.info['id'])
|
||||
@ -3379,18 +3379,18 @@ caused a crash in 0.8.0, so we then disallowed it.
|
||||
with pytest.raises(RpcError, match=r'Do not specify msatoshi \(1001msat\) without'
|
||||
' partid: if you do, it must be exactly'
|
||||
r' the final amount \(1000msat\)'):
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1000, 1)['route'], payment_hash=inv['payment_hash'], msatoshi=1001, bolt11=inv['bolt11'], payment_secret=inv['payment_secret'])
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1000, 1)['route'], payment_hash=inv['payment_hash'], amount_msat=1001, bolt11=inv['bolt11'], payment_secret=inv['payment_secret'])
|
||||
with pytest.raises(RpcError, match=r'Do not specify msatoshi \(999msat\) without'
|
||||
' partid: if you do, it must be exactly'
|
||||
r' the final amount \(1000msat\)'):
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1000, 1)['route'], payment_hash=inv['payment_hash'], msatoshi=999, bolt11=inv['bolt11'], payment_secret=inv['payment_secret'])
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1000, 1)['route'], payment_hash=inv['payment_hash'], amount_msat=999, bolt11=inv['bolt11'], payment_secret=inv['payment_secret'])
|
||||
|
||||
# Can't send MPP payment which pays any more than amount.
|
||||
with pytest.raises(RpcError, match=r'Final amount 1001msat is greater than 1000msat, despite MPP'):
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1001, 1)['route'], payment_hash=inv['payment_hash'], msatoshi=1000, bolt11=inv['bolt11'], partid=1, payment_secret=inv['payment_secret'])
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1001, 1)['route'], payment_hash=inv['payment_hash'], amount_msat=1000, bolt11=inv['bolt11'], partid=1, payment_secret=inv['payment_secret'])
|
||||
|
||||
# But this works
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1001, 1)['route'], payment_hash=inv['payment_hash'], msatoshi=1001, bolt11=inv['bolt11'], payment_secret=inv['payment_secret'])
|
||||
l1.rpc.sendpay(route=l1.rpc.getroute(l2.info['id'], 1001, 1)['route'], payment_hash=inv['payment_hash'], amount_msat=1001, bolt11=inv['bolt11'], payment_secret=inv['payment_secret'])
|
||||
l1.rpc.waitsendpay(inv['payment_hash'])
|
||||
|
||||
inv = only_one(l2.rpc.listinvoices('inv')['invoices'])
|
||||
@ -3602,13 +3602,13 @@ def test_keysend_routehint(node_factory):
|
||||
|
||||
# Without any hints we should fail:
|
||||
with pytest.raises(RpcError):
|
||||
l1.rpc.call("keysend", payload={'destination': dest, 'msatoshi': amt})
|
||||
l1.rpc.call("keysend", payload={'destination': dest, 'amount_msat': amt})
|
||||
|
||||
# We should also fail with only non-working hints:
|
||||
with pytest.raises(RpcError):
|
||||
l1.rpc.call("keysend", payload={'destination': dest, 'msatoshi': amt, 'routehints': routehints[1:]})
|
||||
l1.rpc.call("keysend", payload={'destination': dest, 'amount_msat': amt, 'routehints': routehints[1:]})
|
||||
|
||||
l1.rpc.call("keysend", payload={'destination': dest, 'msatoshi': amt, 'routehints': routehints})
|
||||
l1.rpc.call("keysend", payload={'destination': dest, 'amount_msat': amt, 'routehints': routehints})
|
||||
invs = l3.rpc.listinvoices()['invoices']
|
||||
assert(len(invs) == 1)
|
||||
|
||||
@ -4594,25 +4594,25 @@ def test_fetchinvoice(node_factory, bitcoind):
|
||||
assert len(l3.rpc.listinvoices(offer_id=offer1['offer_id'])['invoices']) == 2
|
||||
|
||||
# We can also set the amount explicitly, to tip.
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'msatoshi': 3})
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'amount_msat': 3})
|
||||
assert l1.rpc.call('decode', [inv1['invoice']])['amount_msat'] == 3
|
||||
l1.rpc.pay(inv1['invoice'])
|
||||
|
||||
# More than ~5x expected is rejected as absurd (it's actually a divide test,
|
||||
# which means we need 15 here, not 11).
|
||||
with pytest.raises(RpcError, match="Remote node sent failure message.*Amount vastly exceeds 2msat"):
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'msatoshi': 15})
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'amount_msat': 15})
|
||||
|
||||
# Underpay is rejected.
|
||||
with pytest.raises(RpcError, match="Remote node sent failure message.*Amount must be at least 2msat"):
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'msatoshi': 1})
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'amount_msat': 1})
|
||||
|
||||
# If no amount is specified in offer, one must be in invoice.
|
||||
offer_noamount = l3.rpc.call('offer', {'amount': 'any',
|
||||
'description': 'any amount test'})
|
||||
with pytest.raises(RpcError, match="msatoshi parameter required"):
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer_noamount['bolt12']})
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer_noamount['bolt12'], 'msatoshi': 100})
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer_noamount['bolt12'], 'amount_msat': 100})
|
||||
# But amount won't appear in changes
|
||||
assert 'msat' not in inv1['changes']
|
||||
|
||||
@ -5070,11 +5070,11 @@ def test_setchannel_enforcement_delay(node_factory, bitcoind):
|
||||
chanid1 = only_one(l1.rpc.getpeer(l2.info['id'])['channels'])['short_channel_id']
|
||||
chanid2 = only_one(l2.rpc.getpeer(l3.info['id'])['channels'])['short_channel_id']
|
||||
|
||||
route = [{'msatoshi': 1011,
|
||||
route = [{'amount_msat': 1011,
|
||||
'id': l2.info['id'],
|
||||
'delay': 20,
|
||||
'channel': chanid1},
|
||||
{'msatoshi': 1000,
|
||||
{'amount_msat': 1000,
|
||||
'id': l3.info['id'],
|
||||
'delay': 10,
|
||||
'channel': chanid2}]
|
||||
@ -5097,7 +5097,7 @@ def test_setchannel_enforcement_delay(node_factory, bitcoind):
|
||||
l1.rpc.waitsendpay(inv['payment_hash'])
|
||||
|
||||
# Test increased amount.
|
||||
route[0]['msatoshi'] += 1
|
||||
route[0]['amount_msat'] += 1
|
||||
inv = l3.rpc.invoice(1000, "test3", "test3")
|
||||
l1.rpc.sendpay(route,
|
||||
payment_hash=inv['payment_hash'],
|
||||
@ -5159,20 +5159,20 @@ def test_sendpay_grouping(node_factory, bitcoind):
|
||||
)
|
||||
wait_for(lambda: len(l1.rpc.listnodes()['nodes']) == 3)
|
||||
|
||||
inv = l3.rpc.invoice(msatoshi='any', label='lbl1', description='desc')['bolt11']
|
||||
inv = l3.rpc.invoice(amount_msat='any', label='lbl1', description='desc')['bolt11']
|
||||
l3.stop() # Stop recipient so the first attempt fails
|
||||
|
||||
assert(len(l1.db.query("SELECT * FROM payments")) == 0)
|
||||
assert(len(l1.rpc.listpays()['pays']) == 0)
|
||||
|
||||
with pytest.raises(RpcError, match=r'Ran out of routes to try after [0-9]+ attempts'):
|
||||
l1.rpc.pay(inv, msatoshi='100000msat')
|
||||
l1.rpc.pay(inv, amount_msat='100000msat')
|
||||
|
||||
# After this one invocation we have one entry in `listpays`
|
||||
assert(len(l1.rpc.listpays()['pays']) == 1)
|
||||
|
||||
with pytest.raises(RpcError, match=r'Ran out of routes to try after [0-9]+ attempts'):
|
||||
l1.rpc.pay(inv, msatoshi='200000msat')
|
||||
l1.rpc.pay(inv, amount_msat='200000msat')
|
||||
|
||||
# Surprise: we should have 2 entries after 2 invocations
|
||||
assert(len(l1.rpc.listpays()['pays']) == 2)
|
||||
@ -5185,7 +5185,7 @@ def test_sendpay_grouping(node_factory, bitcoind):
|
||||
wait_for(lambda: only_one(l3.rpc.listpeers()['peers'])['connected'] is True)
|
||||
scid = l3.rpc.listpeers()['peers'][0]['channels'][0]['short_channel_id']
|
||||
wait_for(lambda: [c['active'] for c in l1.rpc.listchannels(scid)['channels']] == [True, True])
|
||||
l1.rpc.pay(inv, msatoshi='420000msat')
|
||||
l1.rpc.pay(inv, amount_msat='420000msat')
|
||||
|
||||
# And finally we should have all 3 attempts to pay the invoice
|
||||
pays = l1.rpc.listpays()['pays']
|
||||
@ -5221,7 +5221,7 @@ def test_legacyonion(node_factory, bitcoind):
|
||||
"id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59"
|
||||
},
|
||||
"payment_hash": "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925",
|
||||
"msatoshi": "10000msat",
|
||||
"amount_msat": "10000msat",
|
||||
"shared_secrets": [
|
||||
"bd29a24ea1fa5cab1677b22f4980f6aa115d470c2e3052cb08ca7d636441bfd5",
|
||||
"7d70d337a6b898373386d7d2cff05ca8f4d81123f63cf911aa064a6d8849f972"
|
||||
@ -5244,7 +5244,7 @@ def test_pay_manual_exclude(node_factory, bitcoind):
|
||||
chan23 = l2.rpc.listpeers(l3_id)['peers'][0]['channels'][0]
|
||||
scid12 = chan12['short_channel_id'] + '/' + str(chan12['direction'])
|
||||
scid23 = chan23['short_channel_id'] + '/' + str(chan23['direction'])
|
||||
inv = l3.rpc.invoice(msatoshi=123000, label='label1', description='desc')['bolt11']
|
||||
inv = l3.rpc.invoice(amount_msat=123000, label='label1', description='desc')['bolt11']
|
||||
# Exclude the payer node id
|
||||
with pytest.raises(RpcError, match=r'Payer is manually excluded'):
|
||||
l1.rpc.pay(inv, exclude=[l1_id])
|
||||
@ -5277,7 +5277,7 @@ def test_pay_bolt11_metadata(node_factory, bitcoind):
|
||||
# After CI started failing, I *also* hacked it to set expiry to BIGNUM.
|
||||
inv = "lnbcrt1230n1p3yzgcxsp5q8g040f9rl9mu2unkjuj0vn262s6nyrhz5hythk3ueu2lfzahmzspp5ve584t0cv27hwmy0cx9ca8uwyqyfw9y9dm3r8vus9fv36r2l9yjsdq8v3jhxccmq6w35xjueqd9ejqmt9w3skgct5vyxqxra2q2qcqp99q2sqqqqqysgqfw6efxpzk5x5vfj8se46yg667x5cvhyttnmuqyk0q7rmhx3gs249qhtdggnek8c5adm2pztkjddlwyn2art2zg9xap2ckczzl3fzz4qqsej6mf"
|
||||
# Make l2 "know" about this invoice.
|
||||
l2.rpc.invoice(msatoshi=123000, label='label1', description='desc', preimage='00' * 32)
|
||||
l2.rpc.invoice(amount_msat=123000, label='label1', description='desc', preimage='00' * 32)
|
||||
|
||||
with pytest.raises(RpcError, match=r'WIRE_INVALID_ONION_PAYLOAD'):
|
||||
l1.rpc.pay(inv)
|
||||
|
@ -396,7 +396,7 @@ def test_pay_plugin(node_factory):
|
||||
l1.rpc.call('pay')
|
||||
|
||||
# Make sure usage messages are present.
|
||||
msg = 'pay bolt11 [msatoshi] [label] [riskfactor] [maxfeepercent] '\
|
||||
msg = 'pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] '\
|
||||
'[retry_for] [maxdelay] [exemptfee] [localofferid] [exclude] '\
|
||||
'[maxfee] [description]'
|
||||
if DEVELOPER:
|
||||
@ -1076,7 +1076,7 @@ def test_htlc_accepted_hook_resolve(node_factory):
|
||||
{}
|
||||
], wait_for_announce=True)
|
||||
|
||||
inv = l3.rpc.invoice(msatoshi=1000, label="lbl", description="desc", preimage="00" * 32)['bolt11']
|
||||
inv = l3.rpc.invoice(amount_msat=1000, label="lbl", description="desc", preimage="00" * 32)['bolt11']
|
||||
l1.rpc.pay(inv)
|
||||
|
||||
# And the invoice must still be unpaid
|
||||
@ -1093,7 +1093,7 @@ def test_htlc_accepted_hook_direct_restart(node_factory, executor):
|
||||
'plugin': os.path.join(os.getcwd(), 'tests/plugins/hold_htlcs.py')}
|
||||
])
|
||||
|
||||
i1 = l2.rpc.invoice(msatoshi=1000, label="direct", description="desc")['bolt11']
|
||||
i1 = l2.rpc.invoice(amount_msat=1000, label="direct", description="desc")['bolt11']
|
||||
f1 = executor.submit(l1.rpc.pay, i1)
|
||||
|
||||
l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds')
|
||||
@ -1126,7 +1126,7 @@ def test_htlc_accepted_hook_forward_restart(node_factory, executor):
|
||||
{'may_reconnect': True},
|
||||
], wait_for_announce=True)
|
||||
|
||||
i1 = l3.rpc.invoice(msatoshi=1000, label="direct", description="desc")['bolt11']
|
||||
i1 = l3.rpc.invoice(amount_msat=1000, label="direct", description="desc")['bolt11']
|
||||
f1 = executor.submit(l1.dev_pay, i1, use_shadow=False)
|
||||
|
||||
l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds')
|
||||
@ -2054,7 +2054,7 @@ def test_3847_repro(node_factory, bitcoind):
|
||||
amt = 20 * 1000 * 1000
|
||||
|
||||
i1 = l3.rpc.invoice(
|
||||
msatoshi=amt, label="direct", description="desc"
|
||||
amount_msat=amt, label="direct", description="desc"
|
||||
)['bolt11']
|
||||
with pytest.raises(RpcError):
|
||||
l1.rpc.pay(i1, retry_for=10)
|
||||
|
Loading…
Reference in New Issue
Block a user