core-lightning/doc/schemas/lightning-openchannel_update.json
Rusty Russell b327bd30c3 doc: fix all JSON schemas to enforce no additional properties.
Without this, we have hardly any enforcement.  This is why the schema
mistake fixed in the previous patches weren't spotted immediately.

The hard work was done by:

```
$ for f in lightning-*.json; do grep -v '^  "additionalProperties": false,' $f | bagto $f; done
$ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done
$ make fmt-schemas
```

Then checking where 'additionalProperties: true' had been turned to
false (we deliberately use it in some places where there are if
statements in the schema, or occasionally where there can be arbitrary
fields).

[Including doc/rpc-schema-draft.json update by Shahana]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-30 15:39:12 +10:30

264 lines
9.5 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "openchannel_update",
"title": "Command to update a collab channel open",
"description": [
"`openchannel_update` is a low level RPC command which continues an open channel, as specified by *channel_id*. An updated *psbt* is passed in; any changes from the PSBT last returned (either from `openchannel_init` or a previous call to `openchannel_update`) will be communicated to the peer.",
"",
"Must be called after `openchannel_init` and before `openchannel_signed`.",
"",
"Must be called until *commitments_secured* is returned as true, at which point `openchannel_signed` should be called with a signed version of the PSBT returned by the last call to `openchannel_update`."
],
"request": {
"required": [
"channel_id",
"psbt"
],
"additionalProperties": false,
"properties": {
"channel_id": {
"type": "hash",
"description": [
"Id of the channel."
]
},
"psbt": {
"type": "string",
"description": [
"Updated PSBT to be sent to the peer. May be identical to the PSBT last returned by either `openchannel_init` or `openchannel_update`."
]
}
}
},
"response": {
"required": [
"channel_id",
"psbt",
"commitments_secured",
"channel_type",
"funding_outnum"
],
"additionalProperties": false,
"properties": {
"channel_id": {
"type": "hash",
"description": [
"The channel id of the channel."
]
},
"channel_type": {
"type": "object",
"description": [
"Channel_type as negotiated with peer."
],
"added": "v24.02",
"additionalProperties": false,
"required": [
"bits",
"names"
],
"properties": {
"bits": {
"type": "array",
"description": [
"Each bit set in this channel_type."
],
"added": "v24.02",
"items": {
"type": "u32",
"description": [
"Bit number."
]
}
},
"names": {
"type": "array",
"description": [
"Feature name for each bit set in this channel_type. Note that *anchors_zero_fee_htlc_tx* is a deprecated synonym for *anchors*."
],
"added": "v24.02",
"items": {
"type": "string",
"enum": [
"static_remotekey/even",
"anchor_outputs/even",
"anchors_zero_fee_htlc_tx/even",
"anchors/even",
"scid_alias/even",
"zeroconf/even"
],
"description": [
"Name of feature bit."
]
}
}
}
},
"psbt": {
"type": "string",
"description": [
"The PSBT of the funding transaction."
]
},
"commitments_secured": {
"type": "boolean",
"description": [
"Whether the *psbt* is complete (if true, sign *psbt* and call `openchannel_signed` to complete the channel open)."
]
},
"funding_outnum": {
"type": "u32",
"description": [
"The index of the funding output in the psbt."
]
},
"close_to": {
"type": "hex",
"description": [
"Scriptpubkey which we have to close to if we mutual close."
]
},
"requires_confirmed_inputs": {
"type": "boolean",
"description": [
"Does peer require confirmed inputs in psbt?"
]
}
},
"allOf": [
{
"if": {
"additionalProperties": true,
"properties": {
"commitments_secured": {
"type": "boolean",
"enum": [
true
]
}
}
},
"then": {
"additionalProperties": true,
"required": [
"channel_id",
"funding_outnum"
],
"properties": {
"commitments_secured": {},
"channel_id": {
"type": "hash",
"description": [
"The derived channel id."
]
},
"close_to": {
"type": "hex",
"description": [
"If a `close_to` address was provided to `openchannel_init` and the peer supports `option_upfront_shutdownscript`."
]
},
"funding_outnum": {
"type": "u32",
"description": [
"The index of the funding output for this channel in the funding transaction."
]
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"commitments_secured": {}
}
}
}
]
},
"errors": [
"On error, the returned object will contain `code` and `message` properties,",
"with `code` being one of the following:",
"",
"- -32602: If the given parameters are wrong.",
"- -1: Catchall nonspecific error.",
"- 305: Peer is not connected.",
"- 309: PSBT missing required fields",
"- 311: Unknown channel id.",
"- 312: Channel in an invalid state"
],
"author": [
"Lisa Neigut <<niftynei@gmail.com>> is mainly responsible."
],
"see_also": [
"lightning-openchannel_init(7)",
"lightning-openchannel_signed(7)",
"lightning-openchannel_bump(7)",
"lightning-openchannel_abort(7)",
"lightning-fundchannel_start(7)",
"lightning-fundchannel_complete(7)",
"lightning-fundchannel(7)",
"lightning-fundpsbt(7)",
"lightning-utxopsbt(7)",
"lightning-multifundchannel(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:openchannel_update#1",
"method": "openchannel_update",
"params": {
"channel_id": "b020c1c6818daf024954c9ee578caad058cbcae7dd75b2c4d38b8f6f81901ff5",
"psbt": "cHNidP8BAgQCAAAAAQMEmAAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQBxAgAAAAGXS8Ixc7e8qbBg2sEqvRuxWOjtaaPnTU9q9ZGbFfV3LAAAAAAA/f///wJ6H/TSAAAAABYAFJq4HdQFbYJVeXL2XWxTpoyZUCr4AMLrCwAAAAAWABQDz+yHFeH0BKNuwBHkI4+GMp+QnJcAAAABAR8AwusLAAAAABYAFAPP7IcV4fQEo27AEeQjj4Yyn5CcAQ4gswU80whDZOoIHS/lfyxwmHh5USHBwbcjWHaJ9/XU+78BDwQBAAAAARAE/f///wz8CWxpZ2h0bmluZwEIQCsNB0i02NIAAQMIQVncCwAAAAABBCJRIDvhN+WjzUt2EEWojAco0yQ1GDbwTtWd/aN5uNhGRlK3DPwJbGlnaHRuaW5nAQgwkgFDAVpmeAABAwhAQg8AAAAAAAEEIgAgybxcBjyu+/emx4FEB7Vie0+BqLVuy+kyxoL5y6wNGd8M/AlsaWdodG5pbmcBCI9GsPn+O/M0AA=="
}
},
"response": {
"channel_id": "b020c1c6818daf024954c9ee578caad058cbcae7dd75b2c4d38b8f6f81901ff5",
"psbt": "cHNidP8BAgQCAAAAAQMEmAAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQBxAgAAAAGXS8Ixc7e8qbBg2sEqvRuxWOjtaaPnTU9q9ZGbFfV3LAAAAAAA/f///wJ6H/TSAAAAABYAFJq4HdQFbYJVeXL2XWxTpoyZUCr4AMLrCwAAAAAWABQDz+yHFeH0BKNuwBHkI4+GMp+QnJcAAAABAR8AwusLAAAAABYAFAPP7IcV4fQEo27AEeQjj4Yyn5CcAQ4gswU80whDZOoIHS/lfyxwmHh5USHBwbcjWHaJ9/XU+78BDwQBAAAAARAE/f///wz8CWxpZ2h0bmluZwEIQCsNB0i02NIAAQMIQVncCwAAAAABBCJRIDvhN+WjzUt2EEWojAco0yQ1GDbwTtWd/aN5uNhGRlK3DPwJbGlnaHRuaW5nAQgwkgFDAVpmeAABAwhAQg8AAAAAAAEEIgAgybxcBjyu+/emx4FEB7Vie0+BqLVuy+kyxoL5y6wNGd8M/AlsaWdodG5pbmcBCI9GsPn+O/M0AA==",
"channel_type": {
"bits": [
12,
22
],
"names": [
"static_remotekey/even",
"anchors/even"
]
},
"commitments_secured": true,
"funding_outnum": 1,
"close_to": "51202321a432c9022a560c7dae78bdb72c605c373961edd29c42aa98c183782d052a"
}
},
{
"request": {
"id": "example:openchannel_update#2",
"method": "openchannel_update",
"params": [
"b020c1c6818daf024954c9ee578caad058cbcae7dd75b2c4d38b8f6f81901ff5",
"cHNidP8BAgQCAAAAAQMEmAAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQBxAgAAAAGXS8Ixc7e8qbBg2sEqvRuxWOjtaaPnTU9q9ZGbFfV3LAAAAAAA/f///wJ6H/TSAAAAABYAFJq4HdQFbYJVeXL2XWxTpoyZUCr4AMLrCwAAAAAWABQDz+yHFeH0BKNuwBHkI4+GMp+QnJcAAAABAR8AwusLAAAAABYAFAPP7IcV4fQEo27AEeQjj4Yyn5CcAQ4gswU80whDZOoIHS/lfyxwmHh5USHBwbcjWHaJ9/XU+78BDwQBAAAAARAE/f///wz8CWxpZ2h0bmluZwEIwRR1uu1r8GoAAQMIgIQeAAAAAAABBCIAIMm8XAY8rvv3pseBRAe1YntPgai1bsvpMsaC+cusDRnfDPwJbGlnaHRuaW5nAQjdRD+FoUsRIAABAwhiDc0LAAAAAAEEIlEgyRg+3pEh88b9FJiCLEenYCcyJ2ackJUIhDusW72BP2gM/AlsaWdodG5pbmcBCPN/JmOnjFW4AA=="
]
},
"response": {
"channel_id": "b020c1c6818daf024954c9ee578caad058cbcae7dd75b2c4d38b8f6f81901ff5",
"psbt": "cHNidP8BAgQCAAAAAQMEmAAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQBxAgAAAAGXS8Ixc7e8qbBg2sEqvRuxWOjtaaPnTU9q9ZGbFfV3LAAAAAAA/f///wJ6H/TSAAAAABYAFJq4HdQFbYJVeXL2XWxTpoyZUCr4AMLrCwAAAAAWABQDz+yHFeH0BKNuwBHkI4+GMp+QnJcAAAABAR8AwusLAAAAABYAFAPP7IcV4fQEo27AEeQjj4Yyn5CcAQ4gswU80whDZOoIHS/lfyxwmHh5USHBwbcjWHaJ9/XU+78BDwQBAAAAARAE/f///wz8CWxpZ2h0bmluZwEIwRR1uu1r8GoAAQMIgIQeAAAAAAABBCIAIMm8XAY8rvv3pseBRAe1YntPgai1bsvpMsaC+cusDRnfDPwJbGlnaHRuaW5nAQjdRD+FoUsRIAABAwhiDc0LAAAAAAEEIlEgyRg+3pEh88b9FJiCLEenYCcyJ2ackJUIhDusW72BP2gM/AlsaWdodG5pbmcBCPN/JmOnjFW4AA==",
"channel_type": {
"bits": [
12,
22
],
"names": [
"static_remotekey/even",
"anchors/even"
]
},
"commitments_secured": true,
"funding_outnum": 0,
"close_to": "51202321a432c9022a560c7dae78bdb72c605c373961edd29c42aa98c183782d052a"
}
}
]
}