diff --git a/doc/lightning-listconfigs.7.md b/doc/lightning-listconfigs.7.md index 41ffc4869..dbeb9d9f3 100644 --- a/doc/lightning-listconfigs.7.md +++ b/doc/lightning-listconfigs.7.md @@ -35,6 +35,226 @@ RETURN VALUE [comment]: # (GENERATE-FROM-SCHEMA-START) On success, an object is returned, containing: +- **configs** (object, optional) *(added v23.08)*: + - **conf** (object, optional): + - **value\_str** (string): field from cmdline + - **source** (string): source of configuration setting (always "cmdline") + - **clear-plugins** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **disable-mpp** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **mainnet** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **regtest** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **signet** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **testnet** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **important-plugin** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **plugin** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **plugin-dir** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **lightning-dir** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **network** (object, optional): + - **value\_str** (string): field from config or cmdline, or default (can also be changed by `testnet`, `signet`, `regtest` options!) + - **source** (string): source of configuration setting + - **allow-deprecated-apis** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **rpc-file** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **disable-plugin** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **always-use-proxy** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **daemon** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **wallet** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **large-channels** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **experimental-dual-fund** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **experimental-onion-messages** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **experimental-offers** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **experimental-shutdown-wrong-funding** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **experimental-websocket-port** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **experimental-peer-storage** (object, optional) *(added v23.02)*: + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **database-upgrade** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **rgb** (object, optional): + - **value\_str** (hex): field from config or cmdline, or default (always 6 characters) + - **source** (string): source of configuration setting + - **alias** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **pid-file** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **ignore-fee-limits** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **watchtime-blocks** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **max-locktime-blocks** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **funding-confirms** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **cltv-delta** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **cltv-final** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **commit-time** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **fee-base** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **rescan** (object, optional): + - **value\_int** (integer): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **fee-per-satoshi** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **max-concurrent-htlcs** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **htlc-minimum-msat** (object, optional): + - **value\_msat** (msat): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **htlc-maximum-msat** (object, optional): + - **value\_msat** (msat): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **max-dust-htlc-exposure-msat** (object, optional): + - **value\_msat** (msat): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **min-capacity-sat** (object, optional): + - **value\_int** (u64): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **addr** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **announce-addr** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **bind-addr** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **offline** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **autolisten** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **proxy** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **disable-dns** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **announce-addr-discovered** (object, optional) *(added v23.02)*: + - **value\_str** (string): field from config or cmdline, or default (one of "true", "false", "auto") + - **source** (string): source of configuration setting + - **announce-addr-discovered-port** (object, optional) *(added v23.02)*: + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **encrypted-hsm** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **rpc-file-mode** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **log-level** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **log-prefix** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **log-file** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **log-timestamps** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **force-feerates** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **subdaemon** (object, optional): + - **values\_str** (array of strings): + - field from config or cmdline + - **sources** (array of strings): + - source of configuration setting + - **fetchinvoice-noconnect** (object, optional): + - **set** (boolean): `true` if set in config or cmdline + - **source** (string): source of configuration setting + - **accept-htlc-tlv-types** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **tor-service-password** (object, optional): + - **value\_str** (string): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **announce-addr-dns** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **require-confirmed-inputs** (object, optional): + - **value\_bool** (boolean): field from config or cmdline, or default + - **source** (string): source of configuration setting + - **commit-fee** (object, optional): + - **value\_int** (u64): field from config or cmdline, or default + - **source** (string): source of configuration setting - **# version** (string, optional): Special field indicating the current version - **plugins** (array of objects, optional): - **path** (string): Full path of the plugin @@ -55,7 +275,7 @@ On success, an object is returned, containing: - **bookkeeper-db** (string, optional): `bookkeeper-db` field from config or cmdline, or default - **always-use-proxy** (boolean, optional): `always-use-proxy` field from config or cmdline, or default - **daemon** (boolean, optional): `daemon` field from config or cmdline, or default -- **wallet** (string, optional): `wallet` field from config or cmdline, or default +- **wallet** (string, optional): `wallet` field from config or cmdline default - **large-channels** (boolean, optional): `large-channels` field from config or cmdline, or default - **experimental-dual-fund** (boolean, optional): `experimental-dual-fund` field from config or cmdline, or default - **experimental-onion-messages** (boolean, optional): `experimental-onion-messages` field from config or cmdline, or default @@ -226,4 +446,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:a0058065f618170918c09d1672d5800beeff01f0fd2d13914a4ec238398f30c3) +[comment]: # ( SHA256STAMP:c847cb106f78f616b3adfe506ef499c9228f3966a44e6164b9cf49e1cf67d417) diff --git a/doc/schemas/listconfigs.schema.json b/doc/schemas/listconfigs.schema.json index 5ee4375dd..96f0fd703 100644 --- a/doc/schemas/listconfigs.schema.json +++ b/doc/schemas/listconfigs.schema.json @@ -4,6 +4,1288 @@ "additionalProperties": false, "required": [], "properties": { + "configs": { + "added": "v23.08", + "type": "object", + "comment": "Plugins can add fields to this, so we can't rule out additional properties :(", + "additionalProperties": true, + "required": [], + "properties": { + "conf": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from cmdline" + }, + "source": { + "type": "string", + "enum": [ + "cmdline" + ], + "description": "source of configuration setting" + } + } + }, + "clear-plugins": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "disable-mpp": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "mainnet": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "regtest": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "signet": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "testnet": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "important-plugin": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "plugin": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "plugin-dir": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "lightning-dir": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "network": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default (can also be changed by `testnet`, `signet`, `regtest` options!)" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "allow-deprecated-apis": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "rpc-file": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "disable-plugin": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "always-use-proxy": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "daemon": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "wallet": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "large-channels": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "experimental-dual-fund": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "experimental-onion-messages": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "experimental-offers": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "experimental-shutdown-wrong-funding": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "experimental-websocket-port": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "experimental-peer-storage": { + "added": "v23.02", + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "database-upgrade": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "rgb": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "hex", + "description": "field from config or cmdline, or default", + "maxLength": 6, + "minLength": 6 + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "alias": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "pid-file": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "ignore-fee-limits": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "watchtime-blocks": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "max-locktime-blocks": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "funding-confirms": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "cltv-delta": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "cltv-final": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "commit-time": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "fee-base": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "rescan": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "integer", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "fee-per-satoshi": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "max-concurrent-htlcs": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "htlc-minimum-msat": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_msat", + "source" + ], + "properties": { + "value_msat": { + "type": "msat", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "htlc-maximum-msat": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_msat", + "source" + ], + "properties": { + "value_msat": { + "type": "msat", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "max-dust-htlc-exposure-msat": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_msat", + "source" + ], + "properties": { + "value_msat": { + "type": "msat", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "min-capacity-sat": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u64", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "addr": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "announce-addr": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "bind-addr": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "offline": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "autolisten": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "proxy": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "disable-dns": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "announce-addr-discovered": { + "added": "v23.02", + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "enum": [ + "true", + "false", + "auto" + ], + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "announce-addr-discovered-port": { + "added": "v23.02", + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u32", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "encrypted-hsm": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "rpc-file-mode": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "log-level": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "log-prefix": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "log-file": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "log-timestamps": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "force-feerates": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "subdaemon": { + "type": "object", + "additionalProperties": false, + "required": [ + "values_str", + "sources" + ], + "properties": { + "values_str": { + "type": "array", + "items": { + "type": "string", + "description": "field from config or cmdline" + } + }, + "sources": { + "type": "array", + "items": { + "type": "string", + "description": "source of configuration setting" + } + } + } + }, + "fetchinvoice-noconnect": { + "type": "object", + "additionalProperties": false, + "required": [ + "set", + "source" + ], + "properties": { + "set": { + "type": "boolean", + "description": "`true` if set in config or cmdline" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "accept-htlc-tlv-types": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "tor-service-password": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_str", + "source" + ], + "properties": { + "value_str": { + "type": "string", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "announce-addr-dns": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "require-confirmed-inputs": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_bool", + "source" + ], + "properties": { + "value_bool": { + "type": "boolean", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + }, + "commit-fee": { + "type": "object", + "additionalProperties": false, + "required": [ + "value_int", + "source" + ], + "properties": { + "value_int": { + "type": "u64", + "description": "field from config or cmdline, or default" + }, + "source": { + "type": "string", + "description": "source of configuration setting" + } + } + } + } + }, "# version": { "type": "string", "description": "Special field indicating the current version" @@ -111,7 +1393,7 @@ }, "wallet": { "type": "string", - "description": "`wallet` field from config or cmdline, or default" + "description": "`wallet` field from config or cmdline default" }, "large-channels": { "type": "boolean", diff --git a/lightningd/connect_control.c b/lightningd/connect_control.c index 4046ccdb2..6be32373f 100644 --- a/lightningd/connect_control.c +++ b/lightningd/connect_control.c @@ -683,7 +683,9 @@ int connectd_init(struct lightningd *ld) wireaddrs->u.allproto.is_websocket = false; wireaddrs->u.allproto.port = ld->portnum; *listen_announce = ADDR_LISTEN_AND_ANNOUNCE; - } + } else + /* Make it clear that autolisten is not active! */ + ld->autolisten = false; msg = towire_connectd_init( tmpctx, chainparams, diff --git a/lightningd/log.c b/lightningd/log.c index c5b572df1..58ec4fa22 100644 --- a/lightningd/log.c +++ b/lightningd/log.c @@ -628,7 +628,8 @@ static char *arg_log_prefix(const char *arg, struct log_book *log_book) static bool show_log_prefix(char *buf, size_t len, const struct log_book *log_book) { strncpy(buf, log_book->prefix, len); - return true; + /* Default is empty, so don't print that! */ + return !streq(log_book->prefix, ""); } static int signalfds[2]; diff --git a/lightningd/options.c b/lightningd/options.c index cdc396449..c40b5571e 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1713,10 +1713,19 @@ static bool canon_bool(const char *val) return b; } -static void add_config(struct lightningd *ld, - struct json_stream *response, - const struct opt_table *opt, - const char *name, size_t len) +static void check_literal(const char *name, const char *val) +{ + if (streq(val, "true") || streq(val, "false")) + return; + if (!streq(val, "") && strspn(val, "-0123456789.") == strlen(val)) + return; + errx(1, "Bad literal for %s: %s", name, val); +} + +static void add_config_deprecated(struct lightningd *ld, + struct json_stream *response, + const struct opt_table *opt, + const char *name, size_t len) { char *name0 = tal_strndup(tmpctx, name, len); char *answer = NULL; @@ -1905,6 +1914,188 @@ static void add_config(struct lightningd *ld, } } +static void json_add_source(struct json_stream *result, + const char *fieldname, + const struct configvar *cv) +{ + const char *source; + + if (!cv) { + source = "default"; + } else { + source = NULL; + switch (cv->src) { + case CONFIGVAR_CMDLINE: + case CONFIGVAR_CMDLINE_SHORT: + source = "cmdline"; + break; + case CONFIGVAR_EXPLICIT_CONF: + case CONFIGVAR_BASE_CONF: + case CONFIGVAR_NETWORK_CONF: + source = tal_fmt(tmpctx, "%s:%u", cv->file, cv->linenum); + break; + case CONFIGVAR_PLUGIN_START: + source = "pluginstart"; + break; + } + } + json_add_string(result, fieldname, source); +} + +static const char *configval_fieldname(const struct opt_table *ot) +{ + bool multi = (ot->type & OPT_MULTI); + if (ot->type & OPT_SHOWBOOL) + return multi ? "values_bool" : "value_bool"; + if (ot->type & OPT_SHOWINT) + return multi ? "values_int" : "value_int"; + if (ot->type & OPT_SHOWMSATS) + return multi ? "values_msat" : "value_msat"; + return multi ? "values_str" : "value_str"; +} + +#define CONFIG_SHOW_BUFSIZE 4096 + +static const char *get_opt_val(const struct opt_table *ot, + char buf[], + const struct configvar *cv) +{ + if (ot->show == (void *)opt_show_charp) { + /* Don't truncate or quote! */ + return *(char **)ot->u.carg; + } + if (ot->show) { + strcpy(buf + CONFIG_SHOW_BUFSIZE, "..."); + if (ot->show(buf, CONFIG_SHOW_BUFSIZE, ot->u.carg)) + return buf; + return NULL; + } + + /* For everything else we only display if it's set, + * BUT we check here to make sure you've handled + * everything! */ + if (ot->cb_arg == (void *)opt_set_talstr + || ot->cb_arg == (void *)opt_add_proxy_addr + || ot->cb_arg == (void *)opt_force_feerates + || ot->cb_arg == (void *)opt_set_accept_extra_tlv_types + || ot->cb_arg == (void *)opt_set_websocket_port + || ot->cb_arg == (void *)opt_add_plugin + || ot->cb_arg == (void *)opt_add_plugin_dir + || ot->cb_arg == (void *)opt_important_plugin + || ot->cb_arg == (void *)opt_disable_plugin + || ot->cb_arg == (void *)opt_add_addr + || ot->cb_arg == (void *)opt_add_bind_addr + || ot->cb_arg == (void *)opt_add_announce_addr + || ot->cb_arg == (void *)opt_subdaemon + || ot->cb_arg == (void *)opt_set_db_upgrade + || ot->cb_arg == (void *)arg_log_to_file +#if DEVELOPER + || ot->cb_arg == (void *)opt_subd_dev_disconnect + || ot->cb_arg == (void *)opt_force_featureset + || ot->cb_arg == (void *)opt_force_privkey + || ot->cb_arg == (void *)opt_force_bip32_seed + || ot->cb_arg == (void *)opt_force_channel_secrets + || ot->cb_arg == (void *)opt_force_tmp_channel_id +#endif + || is_restricted_print_if_nonnull(ot->cb_arg)) { + /* Only if set! */ + if (cv) + return cv->optarg; + else + return NULL; + } + + /* Insert more decodes here! */ + errx(1, "Unknown decode for %s", ot->names); +} + +static void json_add_configval(struct json_stream *result, + const char *fieldname, + const struct opt_table *ot, + const char *str) +{ + if (ot->type & OPT_SHOWBOOL) { + json_add_bool(result, fieldname, canon_bool(str)); + } else if (ot->type & (OPT_SHOWMSATS|OPT_SHOWINT)) { + check_literal(ot->names, str); + json_add_primitive(result, fieldname, str); + } else + json_add_string(result, fieldname, str); +} + +/* Config vars can have multiple names ("--large-channels|--wumbo"), but first + * is preferred */ +static void json_add_config(struct lightningd *ld, + struct json_stream *response, + bool always_include, + const struct opt_table *ot, + const char **names) +{ + char buf[CONFIG_SHOW_BUFSIZE + sizeof("...")]; + const char *val; + struct configvar *cv; + + /* This tells us if they actually set the option */ + cv = configvar_first(ld->configvars, names); + + /* Ignore dev/hidden options (deprecated) unless they actually used it */ + if (!cv + && (ot->desc == opt_hidden || (ot->type & OPT_DEV)) + && !always_include) { + return; + } + + /* Ignore options which simply exit */ + if (ot->type & OPT_EXITS) + return; + + if (ot->type & OPT_NOARG) { + json_object_start(response, names[0]); + json_add_bool(response, "set", cv != NULL); + json_add_source(response, "source", cv); + json_object_end(response); + return; + } + + assert(ot->type & OPT_HASARG); + + /* FIXME: handle plugin options: either the default or what they set */ + if (ot->cb_arg == (void *)plugin_opt_set) + return; + + if (ot->type & OPT_MULTI) { + json_object_start(response, names[0]); + json_array_start(response, configval_fieldname(ot)); + while (cv) { + val = get_opt_val(ot, buf, cv); + json_add_configval(response, NULL, ot, val); + cv = configvar_next(ld->configvars, cv, names); + } + json_array_end(response); + + /* Iterate again, for sources */ + json_array_start(response, "sources"); + for (cv = configvar_first(ld->configvars, names); + cv; + cv = configvar_next(ld->configvars, cv, names)) { + json_add_source(response, NULL, cv); + } + json_array_end(response); + json_object_end(response); + return; + } + + /* Returns NULL if we don't want to print it */ + val = get_opt_val(ot, buf, cv); + if (!val) + return; + + json_object_start(response, names[0]); + json_add_configval(response, configval_fieldname(ot), ot, val); + json_add_source(response, "source", cv); + json_object_end(response); +} + static struct command_result *param_opt_config(struct command *cmd, const char *name, const char *buffer, @@ -1934,6 +2125,8 @@ static struct command_result *json_listconfigs(struct command *cmd, return command_param_failed(); response = json_stream_success(cmd); + + /* FIXME: Deprecate old output! */ if (!config) json_add_string(response, "# version", version()); @@ -1953,14 +2146,45 @@ static struct command_result *json_listconfigs(struct command *cmd, continue; if (!config || config == &opt_table[i]) { - add_config(cmd->ld, response, &opt_table[i], - name+1, len-1); + add_config_deprecated(cmd->ld, response, &opt_table[i], + name+1, len-1); } /* If we have more than one long name, first * is preferred */ break; } } + + json_object_start(response, "configs"); + for (size_t i = 0; i < opt_count; i++) { + unsigned int len; + const char *name; + const char **names; + + /* FIXME: Print out comment somehow? */ + if (opt_table[i].type == OPT_SUBTABLE) + continue; + + if (config && config != &opt_table[i]) + continue; + + names = tal_arr(tmpctx, const char *, 0); + for (name = first_name(opt_table[i].names, &len); + name; + name = next_name(name, &len)) { + /* Skips over first -, so just need to look for one */ + if (name[0] != '-') + continue; + tal_arr_expand(&names, + tal_strndup(names, name+1, len-1)); + } + /* We don't usually print dev or deprecated options, unless + * they explicitly ask, or they're set. */ + json_add_config(cmd->ld, response, config != NULL, + &opt_table[i], names); + } + json_object_end(response); + return command_success(cmd, response); } diff --git a/tests/test_misc.py b/tests/test_misc.py index 8d1236ef8..953eec5fe 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -741,11 +741,16 @@ def test_listconfigs(node_factory, bitcoind, chainparams): # Test one at a time. for c in configs.keys(): - if c.startswith('#') or c.startswith('plugins') or c == 'important-plugins': + if c.startswith('#') or c.startswith('plugins') or c == 'important-plugins' or c == 'configs': continue oneconfig = l1.rpc.listconfigs(config=c) assert(oneconfig[c] == configs[c]) + # Test modern ones! + for c in configs['configs'].keys(): + oneconfig = l1.rpc.listconfigs(config=c)['configs'] + assert(oneconfig[c] == configs['configs'][c]) + def test_listconfigs_plugins(node_factory, bitcoind, chainparams): l1 = node_factory.get_node()