mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
lightningd: turn on experimental support for zero-fee htlc anchors.
We disabled experimental support for opening non-zero-fee anchor channels (though old nodes may still have such channels if they turned that on!). So we simply call this `experimental-anchors`, since this is the variant which we expect to be used widely. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-EXPERIMENTAL: protocol: added support for zero-fee-htlc anchors (`option_anchors_zero_fee_htlc_tx`), using `--experimental-anchors`.
This commit is contained in:
@@ -135,6 +135,9 @@ On success, an object is returned, containing:
|
|||||||
- **experimental-peer-storage** (object, optional) *(added v23.02)*:
|
- **experimental-peer-storage** (object, optional) *(added v23.02)*:
|
||||||
- **set** (boolean): `true` if set in config or cmdline
|
- **set** (boolean): `true` if set in config or cmdline
|
||||||
- **source** (string): source of configuration setting
|
- **source** (string): source of configuration setting
|
||||||
|
- **experimental-anchors** (object, optional) *(added v23.08)*:
|
||||||
|
- **set** (boolean): `true` if set in config or cmdline
|
||||||
|
- **source** (string): source of configuration setting
|
||||||
- **database-upgrade** (object, optional):
|
- **database-upgrade** (object, optional):
|
||||||
- **value\_bool** (boolean): field from config or cmdline, or default
|
- **value\_bool** (boolean): field from config or cmdline, or default
|
||||||
- **source** (string): source of configuration setting
|
- **source** (string): source of configuration setting
|
||||||
@@ -463,4 +466,4 @@ RESOURCES
|
|||||||
|
|
||||||
Main web site: <https://github.com/ElementsProject/lightning>
|
Main web site: <https://github.com/ElementsProject/lightning>
|
||||||
|
|
||||||
[comment]: # ( SHA256STAMP:0440e4634e4a28681323f891307c7bb61143aacad4824f952f24f027a7543835)
|
[comment]: # ( SHA256STAMP:d24d8d540253bbe3cf9113b265fd3128e351d4615c28f6054730d1b03b363155)
|
||||||
|
|||||||
@@ -728,6 +728,16 @@ protocol to update channel types. At the moment, we only support setting
|
|||||||
this option.
|
this option.
|
||||||
|
|
||||||
|
|
||||||
|
* **experimental-anchors**
|
||||||
|
|
||||||
|
Specifying this option turns on the `option_anchors_zero_fee_htlc_tx`
|
||||||
|
feature, meaning we can open anchor-based channels. This will become
|
||||||
|
the default for new channels in future, after more testing. Anchor-based
|
||||||
|
channels use larger commitment transactions, with the trade-off that they
|
||||||
|
don't have to use a worst-case fee, but can bump the commitment transaction
|
||||||
|
if it's needed. Note that this means that we need to keep
|
||||||
|
some funds aside: see `min-emergency-msat`.
|
||||||
|
|
||||||
BUGS
|
BUGS
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
@@ -493,6 +493,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"experimental-anchors": {
|
||||||
|
"type": "object",
|
||||||
|
"added": "v23.08",
|
||||||
|
"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": {
|
"database-upgrade": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|||||||
@@ -160,6 +160,12 @@ struct ext_key *hsm_init(struct lightningd *ld)
|
|||||||
hsmd_wire_name(ld->hsm_capabilities[i]));
|
hsmd_wire_name(ld->hsm_capabilities[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (feature_offered(ld->our_features->bits[INIT_FEATURE],
|
||||||
|
OPT_ANCHORS_ZERO_FEE_HTLC_TX)
|
||||||
|
&& !hsm_capable(ld, WIRE_HSMD_SIGN_ANCHORSPEND)) {
|
||||||
|
fatal("--experimental-anchors needs HSM capable of signing anchors!");
|
||||||
|
}
|
||||||
|
|
||||||
/* This is equivalent to makesecret("bolt12-invoice-base") */
|
/* This is equivalent to makesecret("bolt12-invoice-base") */
|
||||||
msg = towire_hsmd_derive_secret(NULL, tal_dup_arr(tmpctx, u8,
|
msg = towire_hsmd_derive_secret(NULL, tal_dup_arr(tmpctx, u8,
|
||||||
(const u8 *)INVOICE_PATH_BASE_STRING,
|
(const u8 *)INVOICE_PATH_BASE_STRING,
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
#include <common/wireaddr.h>
|
#include <common/wireaddr.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <hsmd/hsmd_wiregen.h>
|
||||||
#include <lightningd/chaintopology.h>
|
#include <lightningd/chaintopology.h>
|
||||||
|
#include <lightningd/hsm_control.h>
|
||||||
#include <lightningd/options.h>
|
#include <lightningd/options.h>
|
||||||
#include <lightningd/plugin.h>
|
#include <lightningd/plugin.h>
|
||||||
#include <lightningd/subd.h>
|
#include <lightningd/subd.h>
|
||||||
@@ -1187,6 +1189,15 @@ static char *opt_set_quiesce(struct lightningd *ld)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *opt_set_anchor_zero_fee_htlc_tx(struct lightningd *ld)
|
||||||
|
{
|
||||||
|
/* Requires static_remotekey, but we always set that */
|
||||||
|
feature_set_or(ld->our_features,
|
||||||
|
take(feature_set_for_feature(NULL,
|
||||||
|
OPTIONAL_FEATURE(OPT_ANCHORS_ZERO_FEE_HTLC_TX))));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static char *opt_set_offers(struct lightningd *ld)
|
static char *opt_set_offers(struct lightningd *ld)
|
||||||
{
|
{
|
||||||
ld->config.exp_offers = true;
|
ld->config.exp_offers = true;
|
||||||
@@ -1284,6 +1295,10 @@ static void register_opts(struct lightningd *ld)
|
|||||||
opt_set_quiesce, ld,
|
opt_set_quiesce, ld,
|
||||||
"experimental: Advertise ability to quiesce"
|
"experimental: Advertise ability to quiesce"
|
||||||
" channels.");
|
" channels.");
|
||||||
|
opt_register_early_noarg("--experimental-anchors",
|
||||||
|
opt_set_anchor_zero_fee_htlc_tx, ld,
|
||||||
|
"EXPERIMENTAL: enable option_anchors_zero_fee_htlc_tx"
|
||||||
|
" to open zero-fee-anchor channels");
|
||||||
clnopt_witharg("--announce-addr-dns", OPT_EARLY|OPT_SHOWBOOL,
|
clnopt_witharg("--announce-addr-dns", OPT_EARLY|OPT_SHOWBOOL,
|
||||||
opt_set_bool_arg, opt_show_bool,
|
opt_set_bool_arg, opt_show_bool,
|
||||||
&ld->announce_dns,
|
&ld->announce_dns,
|
||||||
|
|||||||
Reference in New Issue
Block a user