Skip to content

Commit

Permalink
add configuration options for allowing zero-conf channels (#127)
Browse files Browse the repository at this point in the history
* add configuration options for allowing zero-conf channels

* check if protocol-no-anchors has not been set and add warning about zero-conf channels
  • Loading branch information
remcoros authored May 16, 2024
1 parent 722cf62 commit bc1426b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configurator/src/lnd.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ healthcheck.chainbackend.attempts=5
protocol.wumbo-channels={protocol_wumbo_channels}
protocol.no-anchors={protocol_no_anchors}
protocol.no-script-enforced-lease={protocol_disable_script_enforced_lease}
protocol.option-scid-alias={protocol_option_scid_alias}
protocol.zero-conf={protocol_zero_conf}

[bolt]
db.bolt.nofreelistsync={db_bolt_no_freelist_sync}
Expand Down
4 changes: 4 additions & 0 deletions configurator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ struct AdvancedConfig {
max_commit_fee_rate_anchors: usize,
max_pending_channels: usize,
protocol_wumbo_channels: bool,
protocol_zero_conf: bool,
protocol_option_scid_alias: bool,
protocol_no_anchors: bool,
protocol_disable_script_enforced_lease: bool,
gc_canceled_invoices_on_startup: bool,
Expand Down Expand Up @@ -431,6 +433,8 @@ fn main() -> Result<(), anyhow::Error> {
autopilot_min_confirmations = config.autopilot.advanced.min_confirmations,
autopilot_confirmation_target = config.autopilot.advanced.confirmation_target,
protocol_wumbo_channels = config.advanced.protocol_wumbo_channels,
protocol_zero_conf = config.advanced.protocol_zero_conf,
protocol_option_scid_alias = config.advanced.protocol_option_scid_alias,
protocol_no_anchors = config.advanced.protocol_no_anchors,
protocol_disable_script_enforced_lease =
config.advanced.protocol_disable_script_enforced_lease,
Expand Down
2 changes: 2 additions & 0 deletions scripts/models/setConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const matchAdvanced2 = shape({
"max-pending-channels": number,
"max-commit-fee-rate-anchors": number,
"protocol-wumbo-channels": boolean,
"protocol-zero-conf": boolean,
"protocol-option-scid-alias": boolean,
"protocol-no-anchors": boolean,
"protocol-disable-script-enforced-lease": boolean,
"gc-canceled-invoices-on-startup": boolean,
Expand Down
16 changes: 16 additions & 0 deletions scripts/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,22 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
"If set, then lnd will create and accept requests for channels larger than 0.16 BTC\n",
"default": false,
},
"protocol-zero-conf": {
"type": "boolean",
"name": "Enable zero-conf Channels",
"description":
"Set to enable support for zero-conf channels. This requires the option-scid-alias flag to also be set.\n",
"warning":
"Zero-conf channels are channels that do not require confirmations to be used. Because of this, the fundee must trust the funder to not double-spend the channel and steal the balance of the channel.",
"default": false,
},
"protocol-option-scid-alias": {
"type": "boolean",
"name": "Enable option-scid-alias Channels",
"description":
"Set to enable support for option_scid_alias channels, which can be referred to by an alias instead of the confirmed ShortChannelID. Additionally, is needed to open zero-conf channels.\n",
"default": false,
},
"protocol-no-anchors": {
"type": "boolean",
"name": "Disable Anchor Channels",
Expand Down
14 changes: 14 additions & 0 deletions scripts/services/setConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ const configRules: Array<Check> = [
}
},
},
{
currentError(config) {
if (config.advanced["protocol-zero-conf"] && !config.advanced["protocol-option-scid-alias"]) {
return "'Advanced > Enable option-scid-alias Channels' must be enabled to enable zero-conf channels'";
}
},
},
{
currentError(config) {
if (config.advanced["protocol-zero-conf"] && config.advanced["protocol-no-anchors"]) {
return "'Advanced > Disable Anchor Channels' must be disabled to enable zero-conf channels'";
}
},
},
];

function checkConfigRules(config: Root): T.KnownError | void {
Expand Down

0 comments on commit bc1426b

Please sign in to comment.