mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
offers: remove deprecated @ prefix.
Somehow, this documentation got lost during the Great Rewrite, so restore that too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-EXPERIMENTAL: JSON-RPC: `offer` removed `@` prefix support from `recurrence_base` (use `recurrence_start_any_period` set to `false`)
This commit is contained in:
parent
fc2f1f42c6
commit
d1d9d7ee6f
10 changed files with 460 additions and 456 deletions
|
@ -2660,6 +2660,7 @@
|
|||
"Offer.recurrence_base": 8,
|
||||
"Offer.recurrence_limit": 10,
|
||||
"Offer.recurrence_paywindow": 9,
|
||||
"Offer.recurrence_start_any_period": 12,
|
||||
"Offer.single_use": 11
|
||||
},
|
||||
"OfferResponse": {
|
||||
|
@ -9586,6 +9587,10 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Offer.recurrence_start_any_period": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"Offer.single_use": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
|
|
1
cln-grpc/proto/node.proto
generated
1
cln-grpc/proto/node.proto
generated
|
@ -2313,6 +2313,7 @@ message OfferRequest {
|
|||
optional string recurrence_paywindow = 9;
|
||||
optional uint32 recurrence_limit = 10;
|
||||
optional bool single_use = 11;
|
||||
optional bool recurrence_start_any_period = 12;
|
||||
}
|
||||
|
||||
message OfferResponse {
|
||||
|
|
2
cln-grpc/src/convert.rs
generated
2
cln-grpc/src/convert.rs
generated
|
@ -4888,6 +4888,7 @@ impl From<requests::OfferRequest> for pb::OfferRequest {
|
|||
recurrence_base: c.recurrence_base, // Rule #2 for type string?
|
||||
recurrence_limit: c.recurrence_limit, // Rule #2 for type u32?
|
||||
recurrence_paywindow: c.recurrence_paywindow, // Rule #2 for type string?
|
||||
recurrence_start_any_period: c.recurrence_start_any_period, // Rule #2 for type boolean?
|
||||
single_use: c.single_use, // Rule #2 for type boolean?
|
||||
}
|
||||
}
|
||||
|
@ -6288,6 +6289,7 @@ impl From<pb::OfferRequest> for requests::OfferRequest {
|
|||
recurrence_base: c.recurrence_base, // Rule #1 for type string?
|
||||
recurrence_limit: c.recurrence_limit, // Rule #1 for type u32?
|
||||
recurrence_paywindow: c.recurrence_paywindow, // Rule #1 for type string?
|
||||
recurrence_start_any_period: c.recurrence_start_any_period, // Rule #1 for type boolean?
|
||||
single_use: c.single_use, // Rule #1 for type boolean?
|
||||
}
|
||||
}
|
||||
|
|
2
cln-rpc/src/model.rs
generated
2
cln-rpc/src/model.rs
generated
|
@ -2824,6 +2824,8 @@ pub mod requests {
|
|||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub recurrence_paywindow: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub recurrence_start_any_period: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub single_use: Option<bool>,
|
||||
pub amount: String,
|
||||
pub description: String,
|
||||
|
|
|
@ -23108,16 +23108,9 @@
|
|||
]
|
||||
},
|
||||
"recurrence_base": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"type": "integer",
|
||||
"description": [
|
||||
"Time in seconds since the first day of 1970 UTC, optionally with a `@` prefix. This indicates when the first period begins; without this, the recurrence periods start from the first invoice. The `@` prefix means that the invoice must start by paying the first period; otherwise it is permitted to start at any period. This is encoded in the offer. e.g. `@1609459200` indicates you must start paying on the 1st January 2021."
|
||||
"Time in seconds since the first day of 1970 UTC. This indicates when the first period begins; without this, the recurrence periods start from the first invoice."
|
||||
]
|
||||
},
|
||||
"recurrence_paywindow": {
|
||||
|
@ -23139,6 +23132,14 @@
|
|||
"Indicates that the offer is only valid once; we may issue multiple invoices, but as soon as one is paid all other invoices will be expired (i.e. only one person can pay this offer)."
|
||||
],
|
||||
"default": "False"
|
||||
},
|
||||
"recurrence_start_any_period": {
|
||||
"added": "v24.02",
|
||||
"type": "boolean",
|
||||
"description": [
|
||||
"This means that the invoice may start by paying during any period; otherwise it must start by paying at the first period. Setting this to false only makes sense if *recurrence_base* was provided. This is encoded in the offer."
|
||||
],
|
||||
"default": "True"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,7 +24,6 @@ hidden: false
|
|||
| options.flag.default-not-false | Getmanifest Reply | v23.08 | v24.08 | `flag` options with a default which is not `false` (would be meaningless, since user can only set it to `true` |
|
||||
| plugin.nonumericids | Getmanifest Reply | v23.08 | v24.08 | Plugins must specify that they can accept non-numeric command ids (numeric ids are deprecated) |
|
||||
| listchannels.include_private | Field(s) | v24.02 | v24.08 | `listchannels` including private channels (now use listpeerchannels which gives far more detail) |
|
||||
| offer.recurrence_base.at_prefix | Parameter | v24.02 | v24.05 | `recurrence_base` with `@` prefix (use `recurrence_start_any_period`) |
|
||||
| max-locktime-blocks | Config | v24.05 | v24.11 | --max-locktime-blocks is now set to 2016 in the BOLT 4 spec |
|
||||
|
||||
|
||||
|
|
|
@ -66,16 +66,9 @@
|
|||
]
|
||||
},
|
||||
"recurrence_base": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"type": "integer",
|
||||
"description": [
|
||||
"Time in seconds since the first day of 1970 UTC, optionally with a `@` prefix. This indicates when the first period begins; without this, the recurrence periods start from the first invoice. The `@` prefix means that the invoice must start by paying the first period; otherwise it is permitted to start at any period. This is encoded in the offer. e.g. `@1609459200` indicates you must start paying on the 1st January 2021."
|
||||
"Time in seconds since the first day of 1970 UTC. This indicates when the first period begins; without this, the recurrence periods start from the first invoice."
|
||||
]
|
||||
},
|
||||
"recurrence_paywindow": {
|
||||
|
@ -97,6 +90,14 @@
|
|||
"Indicates that the offer is only valid once; we may issue multiple invoices, but as soon as one is paid all other invoices will be expired (i.e. only one person can pay this offer)."
|
||||
],
|
||||
"default": "False"
|
||||
},
|
||||
"recurrence_start_any_period": {
|
||||
"added": "v24.02",
|
||||
"type": "boolean",
|
||||
"description": [
|
||||
"This means that the invoice may start by paying during any period; otherwise it must start by paying at the first period. Setting this to false only makes sense if *recurrence_base* was provided. This is encoded in the offer."
|
||||
],
|
||||
"default": "True"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -162,18 +162,10 @@ static struct command_result *param_recurrence_base(struct command *cmd,
|
|||
const jsmntok_t *tok,
|
||||
struct recurrence_base **base)
|
||||
{
|
||||
/* Make copy so we can manipulate it */
|
||||
jsmntok_t t = *tok;
|
||||
|
||||
*base = tal(cmd, struct recurrence_base);
|
||||
if (command_deprecated_in_ok(cmd, "recurrence_base.at_prefix", "v24.02", "v24.05")
|
||||
&& json_tok_startswith(buffer, &t, "@")) {
|
||||
t.start++;
|
||||
(*base)->start_any_period = false;
|
||||
} else
|
||||
(*base)->start_any_period = true;
|
||||
(*base)->start_any_period = true;
|
||||
|
||||
if (!json_to_u64(buffer, &t, &(*base)->basetime))
|
||||
if (!json_to_u64(buffer, tok, &(*base)->basetime))
|
||||
return command_fail_badparam(cmd, name, buffer, tok,
|
||||
"not a valid basetime");
|
||||
return NULL;
|
||||
|
|
|
@ -4390,13 +4390,6 @@ def test_offer(node_factory, bitcoind):
|
|||
# Test base
|
||||
# (1456740000 == 10:00:00 (am) UTC on 29 February, 2016)
|
||||
|
||||
# This is deprecated, try modern alternative:
|
||||
with pytest.raises(RpcError, match='invalid token'):
|
||||
l1.rpc.call('offer', {'amount': '100000sat',
|
||||
'description': 'quantity_max test',
|
||||
'recurrence': '10minutes',
|
||||
'recurrence_base': '@1456740000'})
|
||||
|
||||
# Cannot use recurrence_start_any_period without recurrence_base
|
||||
with pytest.raises(RpcError, match='Cannot set to false without specifying recurrence_base'):
|
||||
l1.rpc.call('offer', {'amount': '100000sat',
|
||||
|
@ -4407,7 +4400,7 @@ def test_offer(node_factory, bitcoind):
|
|||
ret = l1.rpc.call('offer', {'amount': '100000sat',
|
||||
'description': 'quantity_max test',
|
||||
'recurrence': '10minutes',
|
||||
'recurrence_base': '1456740000',
|
||||
'recurrence_base': 1456740000,
|
||||
'recurrence_start_any_period': False})
|
||||
offer = only_one(l1.rpc.call('listoffers', [ret['offer_id']])['offers'])
|
||||
output = subprocess.check_output([bolt12tool, 'decode',
|
||||
|
@ -4418,7 +4411,7 @@ def test_offer(node_factory, bitcoind):
|
|||
ret = l1.rpc.call('offer', {'amount': '100000sat',
|
||||
'description': 'quantity_max test',
|
||||
'recurrence': '10minutes',
|
||||
'recurrence_base': '1456740000'})
|
||||
'recurrence_base': 1456740000})
|
||||
offer = only_one(l1.rpc.call('listoffers', [ret['offer_id']])['offers'])
|
||||
output = subprocess.check_output([bolt12tool, 'decode',
|
||||
offer['bolt12']]).decode('UTF-8')
|
||||
|
@ -4444,6 +4437,14 @@ def test_offer(node_factory, bitcoind):
|
|||
offer['bolt12']]).decode('UTF-8')
|
||||
assert 'recurrence: every 600 seconds paywindow -10 to +600 (pay proportional)\n' in output
|
||||
|
||||
# This is deprecated:
|
||||
l1.rpc.jsonschemas = {}
|
||||
with pytest.raises(RpcError, match='invalid token'):
|
||||
l1.rpc.call('offer', {'amount': '100000sat',
|
||||
'description': 'test deprecated recurrence_base',
|
||||
'recurrence': '10minutes',
|
||||
'recurrence_base': '@1456740000'})
|
||||
|
||||
|
||||
def test_offer_deprecated_api(node_factory, bitcoind):
|
||||
l1, l2 = node_factory.line_graph(2, opts={'experimental-offers': None,
|
||||
|
|
Loading…
Add table
Reference in a new issue