Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add configuration options for allowing zero-conf channels #127

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'";
}
},
Comment on lines +35 to +39
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the lnd documentation, it seem zero-conf also requires anchor channels.

While anchors are enabled by default, I believe we should probably include a conditional to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added an additional config rule for it

},
{
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