doc/schemas: fixes for request schemas.

Types are fixed, in particular:

* rename "OutputDesc" to more consistent "outputdesc".
* rename "utxo" to more consistent "outpoint".
* it's "boolean" not "bool".
* "number" means int or float, usually it should be u32.

Specific commands:

* close `id` can be by channel id, scid.
* close `feerange` is a feerate type.
* datastore/deldatastore/listdatastore `key` can be singleton.
* delexpiredinvoice: `maxexpirytime` is not required, is a u64.
* invoice/delinvoice/listinvoice `label` can be an integer
* fundpsbt: many fields are u32 not number (JSON for int or float).
* invoice: `msatoshi` can be "any".
* invoice: `expiry` has a type (now must be numeric).
* invoice: `exposeprivatechannels` can be bool or array of scids.
* invoice: `deschashonly` added
* keysend: there's no "float" type, use "number" or "u32" etc.
* keysend: `routehints` is a valid arg, as is `extratlvs` (EXPERIMENTAL_FEATURES)
* listdatastore: `key` is not required.
* newaddr: `addresstype` can be "all"
* pay: `exemptfee` is "msat", new fields `locaofferid` and `exclude`
* sendonion: was mis-formatted, missed `localofferid` and `groupid` fields.
* sendpay: add `localofferid` and `groupid` params.
* signpsbt: add `signonly` param.
* txprepare "outptus" typo.
* waitsendpay: add `groupid` and  fix `partid` type.
* withdraw: `destination` is a bitcoin address, not a pubkey.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-04-01 14:43:34 +10:30
parent 3b11292e72
commit b45b731c55
23 changed files with 241 additions and 93 deletions

View file

@ -1159,7 +1159,12 @@ class LightningNode(object):
"cltv": cltv,
"dev-routes": dev_routes,
}
return self.rpc.call("invoice", payload)
# FIXME? dev options are not in schema
old_check = self.rpc.check_request_schemas
self.rpc.check_request_schemas = False
ret = self.rpc.call("invoice", payload)
self.rpc.check_request_schemas = old_check
return ret
@contextmanager

View file

@ -7,8 +7,8 @@
],
"properties": {
"id": {
"type": "pubkey",
"description": ""
"type": "string",
"description": "peer id, channel id or short_channel_id"
},
"unilateraltimeout": {
"type": "u32",
@ -31,9 +31,9 @@
"description": ""
},
"feerange": {
"type": {
"type": "array",
"items": "u32"
"type": "array",
"items": {
"type": "feerate"
},
"description": ""
}

View file

@ -7,7 +7,7 @@
],
"properties": {
"id": {
"type": "pubkey",
"type": "string",
"description": ""
},
"host": {

View file

@ -7,11 +7,22 @@
],
"properties": {
"key": {
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
"oneOf": [
{
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"string": {
"type": "string",
"description": ""
},
"hex": {
"type": "hex",

View file

@ -7,11 +7,18 @@
],
"properties": {
"key": {
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
"oneOf": [
{
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"generation": {
"type": "u64",

View file

@ -2,12 +2,10 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"maxexpirytime"
],
"required": [],
"properties": {
"maxexpirytime": {
"type": "u32",
"type": "u64",
"description": ""
}
}

View file

@ -8,8 +8,16 @@
],
"properties": {
"label": {
"type": "string",
"description": ""
"oneOf": [
{
"type": "string",
"description": ""
},
{
"type": "integer",
"description": ""
}
]
},
"status": {
"type": "string",
@ -18,6 +26,9 @@
"expired",
"unpaid"
]
},
"desconly": {
"type": "boolean"
}
}
}

View file

@ -15,23 +15,23 @@
"type": "feerate"
},
"startweight": {
"type": "number"
"type": "u32"
},
"minconf": {
"type": "number"
"type": "u32"
},
"reserve": {
"type": "number",
"type": "u32",
"description": "reserve is a number: if non-zero number then reserveinputs is called (successfully, with exclusive true) on the returned PSBT for this number of blocks (default: 72)."
},
"locktime": {
"type": "number"
"type": "u32"
},
"min_witness_weight": {
"type": "u32"
},
"excess_as_change": {
"type": "bool"
"type": "boolean"
}
}
}

View file

@ -9,7 +9,7 @@
],
"properties": {
"msatoshi": {
"type": "msat|any",
"type": "msat_or_any",
"description": ""
},
"description": {
@ -17,11 +17,19 @@
"description": ""
},
"label": {
"type": "string",
"description": ""
"oneOf": [
{
"type": "string",
"description": ""
},
{
"type": "integer",
"description": ""
}
]
},
"expiry": {
"type": "",
"type": "u64",
"description": ""
},
"fallbacks": {
@ -36,12 +44,29 @@
"description": ""
},
"exposeprivatechannels": {
"type": "bool",
"description": ""
"oneOf": [
{
"type": "boolean",
"description": ""
},
{
"type": "array",
"items": {
"type": "short_channel_id"
}
},
{
"type": "short_channel_id"
}
]
},
"cltv": {
"type": "u32",
"description": ""
},
"deschashonly": {
"type": "boolean",
"description": ""
}
}
}

View file

@ -17,16 +17,55 @@
"type": "string"
},
"maxfeepercent": {
"type": "float"
"type": "number"
},
"retry_for": {
"type": "number"
"type": "u32"
},
"maxdelay": {
"type": "number"
"type": "u32"
},
"exemptfee": {
"type": "msat"
},
"routehints": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"scid",
"feebase",
"feeprop",
"expirydelta"
],
"properties": {
"id": {
"type": "pubkey"
},
"scid": {
"type": "short_channel_id"
},
"feebase": {
"type": "msat"
},
"feeprop": {
"type": "u32"
},
"expirydelta": {
"type": "u16"
}
}
}
}
},
"extratlvs": {
"type": "object",
"additionalProperties": true,
"required": []
}
}
}

View file

@ -2,16 +2,22 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"key"
],
"required": [],
"properties": {
"key": {
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
"oneOf": [
{
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
},
{
"type": "string",
"description": ""
}
]
}
}
}

View file

@ -5,8 +5,16 @@
"required": [],
"properties": {
"label": {
"type": "string",
"description": ""
"oneOf": [
{
"type": "string",
"description": ""
},
{
"type": "integer",
"description": ""
}
]
},
"invstring": {
"type": "string",

View file

@ -8,7 +8,8 @@
"type": "string",
"enum": [
"bech32",
"p2sh-segwit"
"p2sh-segwit",
"all"
]
}
}

View file

@ -16,10 +16,10 @@
"type": "string"
},
"riskfactor": {
"type": "float"
"type": "number"
},
"maxfeepercent": {
"type": "f32"
"type": "number"
},
"retry_for": {
"type": "u16"
@ -28,7 +28,23 @@
"type": "u16"
},
"exemptfee": {
"type": "f32"
"type": "msat"
},
"localofferid": {
"type": "hex"
},
"exclude": {
"type": "array",
"items": {
"oneOf": [
{
"type": "short_channel_id_dir"
},
{
"type": "pubkey"
}
]
}
}
}
}

View file

@ -28,31 +28,37 @@
"delay": {
"type": "u16"
}
},
"payment_hash": {
"type": "hex"
},
"label": {
"type": "string"
},
"shared_secrets": {
"type": "array",
"itemtype": {
"type": "hex"
}
},
"partid": {
"type": "u16"
},
"bolt11": {
"type": "string"
},
"msatoshi": {
"type": "msat"
},
"destination": {
"type": "pubkey"
}
},
"payment_hash": {
"type": "hex"
},
"label": {
"type": "string"
},
"shared_secrets": {
"type": "array",
"items": {
"type": "hex"
}
},
"partid": {
"type": "u16"
},
"bolt11": {
"type": "string"
},
"msatoshi": {
"type": "msat"
},
"destination": {
"type": "pubkey"
},
"localofferid": {
"type": "hash"
},
"groupid": {
"type": "u64"
}
}
}

View file

@ -50,6 +50,12 @@
},
"partid": {
"type": "u16"
},
"localofferid": {
"type": "hex"
},
"groupid": {
"type": "u64"
}
}
}

View file

@ -10,7 +10,7 @@
"type": "string"
},
"reserve": {
"type": "bool"
"type": "boolean"
}
}
}

View file

@ -8,6 +8,12 @@
"properties": {
"psbt": {
"type": "string"
},
"signonly": {
"type": "array",
"items": {
"type": "u32"
}
}
}
}

View file

@ -6,10 +6,10 @@
"outputs"
],
"properties": {
"outptus": {
"outputs": {
"type": "array",
"items": {
"type": "OutputDesc"
"type": "outputdesc"
}
},
"feerate": {
@ -21,7 +21,7 @@
"utxos": {
"type": "array",
"items": {
"type": "utxo"
"type": "outpoint"
}
}
}

View file

@ -16,29 +16,29 @@
"type": "feerate"
},
"startweight": {
"type": "number"
"type": "u32"
},
"utxos": {
"type": "array",
"items": {
"type": "utxo"
"type": "outpoint"
}
},
"reserve": {
"type": "number",
"type": "u32",
"description": "reserve is a number: if non-zero number then reserveinputs is called (successfully, with exclusive true) on the returned PSBT for this number of blocks (default: 72)."
},
"reservedok": {
"type": "bool"
"type": "boolean"
},
"locktime": {
"type": "number"
"type": "u32"
},
"min_witness_weight": {
"type": "u32"
},
"excess_as_change": {
"type": "bool"
"type": "boolean"
}
}
}

View file

@ -5,10 +5,10 @@
"required": [],
"properties": {
"lastpay_index": {
"type": "number"
"type": "u64"
},
"timeout": {
"type": "number"
"type": "u64"
}
}
}

View file

@ -9,11 +9,14 @@
"payment_hash": {
"type": "hex"
},
"partid": {
"type": "u16"
},
"timeout": {
"type": "u32"
},
"partid": {
"type": "u64"
},
"groupid": {
"type": "u64"
}
}
}

View file

@ -7,10 +7,10 @@
],
"properties": {
"destination": {
"type": "pubkey"
"type": "string"
},
"satoshi": {
"type": "msat|all"
"type": "msat_or_all"
},
"feerate": {
"type": "feerate"
@ -21,7 +21,7 @@
"utxos": {
"type": "array",
"items": {
"type": "utxo"
"type": "outpoint"
}
}
}