mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
fetchinvoice: amount_msat not msat.
The name in the spec is `msat`, but I don't want to make an API exception. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `fetchinvoice` `changes` `amount_msat` Changelog-Deprecated: JSON-RPC: `fetchinvoice` `changes` `msat` (use `amount_msat`)
This commit is contained in:
parent
f117225436
commit
fccb11a641
4 changed files with 10 additions and 6 deletions
|
@ -56,7 +56,7 @@ On success, an object is returned, containing:
|
|||
- **description** (string, optional): a completely replaced *description* field
|
||||
- **vendor_removed** (string, optional): The *vendor* from the offer, which is missing in the invoice
|
||||
- **vendor** (string, optional): a completely replaced *vendor* field
|
||||
- **msat** (msat, optional): the amount, if different from the offer amount multiplied by any *quantity* (or the offer had no amount, or was not in BTC).
|
||||
- **amount_msat** (msat, optional): the amount, if different from the offer amount multiplied by any *quantity* (or the offer had no amount, or was not in BTC).
|
||||
- **next_period** (object, optional): Only for recurring invoices if the next period is under the *recurrence_limit*:
|
||||
- **counter** (u64): the index of the next period to fetchinvoice
|
||||
- **starttime** (u64): UNIX timestamp that the next period starts
|
||||
|
@ -88,4 +88,4 @@ RESOURCES
|
|||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
|
||||
[comment]: # ( SHA256STAMP:e0033e40d86355e51abb48472f802a9a713ed5b2725828467515f9541207dac5)
|
||||
[comment]: # ( SHA256STAMP:fa4e9733716ba263e8288613633ec7e0e466c13fc8067b11588bfd3c88901672)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"type": "string",
|
||||
"description": "a completely replaced *vendor* field"
|
||||
},
|
||||
"msat": {
|
||||
"amount_msat": {
|
||||
"type": "msat",
|
||||
"description": "the amount, if different from the offer amount multiplied by any *quantity* (or the offer had no amount, or was not in BTC)."
|
||||
}
|
||||
|
|
|
@ -345,9 +345,13 @@ static struct command_result *handle_invreq_response(struct command *cmd,
|
|||
*/
|
||||
/* We always tell them this unless it's trivial to calc and
|
||||
* exactly as expected. */
|
||||
if (!expected_amount || *inv->amount != *expected_amount)
|
||||
json_add_amount_msat_only(out, "msat",
|
||||
if (!expected_amount || *inv->amount != *expected_amount) {
|
||||
if (deprecated_apis)
|
||||
json_add_amount_msat_only(out, "msat",
|
||||
amount_msat(*inv->amount));
|
||||
json_add_amount_msat_only(out, "amount_msat",
|
||||
amount_msat(*inv->amount));
|
||||
}
|
||||
json_object_end(out);
|
||||
|
||||
/* We tell them about next period at this point, if any. */
|
||||
|
|
|
@ -4708,7 +4708,7 @@ def test_fetchinvoice(node_factory, bitcoind):
|
|||
'description': 'USD test'})['bolt12']
|
||||
|
||||
inv = l1.rpc.call('fetchinvoice', {'offer': offerusd})
|
||||
assert inv['changes']['msat'] == Millisatoshi(int(10.05 * 5000))
|
||||
assert inv['changes']['amount_msat'] == Millisatoshi(int(10.05 * 5000))
|
||||
|
||||
# If we remove plugin, it can no longer give us an invoice.
|
||||
l3.rpc.plugin_stop(plugin)
|
||||
|
|
Loading…
Add table
Reference in a new issue