From 285eee38ba5802af918ca9a9c33dc36a551d1b71 Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Tue, 31 Oct 2023 14:24:50 -0500 Subject: [PATCH] ld: add commit-fee-offset option, update config schema Changelog-Added: Added option --commit-fee-offset to potentially reduce feerate update disagreements --- .../getting-started/configuration.md | 9 ++++++-- doc/lightning-listconfigs.7.md | 6 ++++- doc/lightningd-config.5.md | 5 ++++ doc/schemas/listconfigs.schema.json | 23 +++++++++++++++++++ lightningd/options.c | 3 +++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/doc/getting-started/getting-started/configuration.md b/doc/getting-started/getting-started/configuration.md index 6f1ed2631cfd..296a0fd80a98 100644 --- a/doc/getting-started/getting-started/configuration.md +++ b/doc/getting-started/getting-started/configuration.md @@ -14,8 +14,8 @@ To use a configuration file, create a file named `config` within your top-level When `lightningd` starts up it usually reads a general configuration file (default: `$HOME/.lightning/config`) then a network-specific configuration file (default: `$HOME/.lightning/testnet/config`). This can be changed using `--conf` and `--lightning-dir`. -> 📘 -> +> 📘 +> > General configuration files are processed first, then network-specific ones, then command line options: later options override earlier ones except _addr_ options and _log-level_ with subsystems, which accumulate. `include` followed by a filename includes another configuration file at that point, relative to the current configuration file. @@ -313,6 +313,11 @@ The [`lightning-listconfigs`](ref:lightning-listconfigs) command will output a v The percentage of _estimatesmartfee 2/CONSERVATIVE_ to use for the commitment transactions: default is 100. +- **commit-feerate-offset**=_INTEGER_ + +The additional feerate a channel opener adds to their preferred feerate to +lessen the odds of a disconnect due to feerate disagreement (default 5). + - **max-concurrent-htlcs**=_INTEGER_ Number of HTLCs one channel can handle concurrently in each direction. diff --git a/doc/lightning-listconfigs.7.md b/doc/lightning-listconfigs.7.md index 2c562d49d24d..087e230042c0 100644 --- a/doc/lightning-listconfigs.7.md +++ b/doc/lightning-listconfigs.7.md @@ -281,6 +281,9 @@ On success, an object is returned, containing: - **commit-fee** (object, optional): - **value\_int** (u64): field from config or cmdline, or default - **source** (string): source of configuration setting + - **commit-feerate-offset** (object, optional): + - **value\_int** (u32): field from config or cmdline, or default + - **source** (string): source of configuration setting - **# version** (string, optional): Special field indicating the current version **deprecated, removal in v24.05** - **plugins** (array of objects, optional) **deprecated, removal in v24.05**: - **path** (string): Full path of the plugin @@ -359,6 +362,7 @@ On success, an object is returned, containing: - **developer** (boolean, optional): Whether developer mode is enabled *(added v23.08)* - **commit-fee** (u64, optional): The percentage of the 6-block fee estimate to use for commitment transactions **deprecated, removal in v24.05** *(added v23.05)* - **min-emergency-msat** (msat, optional): field from config or cmdline, or default *(added v23.08)* +- **commit-feerate-offset** (u32, optional): additional commitment feerate applied by channel owner *(added v23.11)* [comment]: # (GENERATE-FROM-SCHEMA-END) @@ -476,4 +480,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:cc7b6d10f93b9efb34ad76d0cc2273d29189a8dd7ef4acef2e5227755c279ea8) +[comment]: # ( SHA256STAMP:245e056bdda7c8015917c89e243a0fd3bdd1512ca760da5d7f0a284cb3214ef7) diff --git a/doc/lightningd-config.5.md b/doc/lightningd-config.5.md index 192164f9b423..6b5edde12010 100644 --- a/doc/lightningd-config.5.md +++ b/doc/lightningd-config.5.md @@ -420,6 +420,11 @@ opens a channel before the channel is usable. The percentage of *estimatesmartfee 2/CONSERVATIVE* to use for the commitment transactions: default is 100. +* **commit-feerate-offset**=*INTEGER* + +The additional feerate a channel opener adds to their preferred feerate to +lessen the odds of a disconnect due to feerate disagreement (default 5). + * **max-concurrent-htlcs**=*INTEGER* Number of HTLCs one channel can handle concurrently in each direction. diff --git a/doc/schemas/listconfigs.schema.json b/doc/schemas/listconfigs.schema.json index 7f971f61af29..bc307d191752 100644 --- a/doc/schemas/listconfigs.schema.json +++ b/doc/schemas/listconfigs.schema.json @@ -1351,6 +1351,24 @@ "description": "source of configuration setting" } } + }, + "commit-feerate-offset": { + "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" + } + } } } }, @@ -1770,6 +1788,11 @@ "type": "msat", "added": "v23.08", "description": "field from config or cmdline, or default" + }, + "commit-feerate-offset": { + "type": "u32", + "added": "v23.11", + "description": "additional commitment feerate applied by channel owner" } } } diff --git a/lightningd/options.c b/lightningd/options.c index 8f4424a96b87..3b04102678dd 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1578,6 +1578,9 @@ static void register_opts(struct lightningd *ld) clnopt_witharg("--commit-fee", OPT_SHOWINT, opt_set_u64, opt_show_u64, &ld->config.commit_fee_percent, "Percentage of fee to request for their commitment"); + clnopt_witharg("--commit-feerate-offset", OPT_SHOWINT, + opt_set_u32, opt_show_u32, &ld->config.feerate_offset, + "Percentage of fee to request for their commitment"); clnopt_witharg("--min-emergency-msat", OPT_SHOWMSATS, opt_set_sat_nondust, opt_show_sat, &ld->emergency_sat, "Amount to leave in wallet for spending anchor closes");