diff --git a/backend/src/config/spec.rs b/backend/src/config/spec.rs index 488252b8a..e85837938 100644 --- a/backend/src/config/spec.rs +++ b/backend/src/config/spec.rs @@ -15,6 +15,7 @@ use jsonpath_lib::Compiled as CompiledJsonPath; use patch_db::{DbHandle, LockReceipt, LockType}; use rand::{CryptoRng, Rng}; use regex::Regex; +use serde::de::{MapAccess, Visitor}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_json::{Number, Value}; use sqlx::SqlitePool; @@ -1167,18 +1168,87 @@ pub struct Pattern { pub pattern_description: String, } -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize)] pub struct ValueSpecString { - #[serde(flatten)] pub pattern: Option, - #[serde(default)] pub copyable: bool, - #[serde(default)] pub masked: bool, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(default)] pub placeholder: Option, } +impl<'de> Deserialize<'de> for ValueSpecString { + fn deserialize>(deserializer: D) -> Result { + struct ValueSpecStringVisitor; + impl<'de> Visitor<'de> for ValueSpecStringVisitor { + type Value = ValueSpecString; + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("struct ValueSpecString") + } + fn visit_map>(self, mut map: V) -> Result { + let mut pattern = None; + let mut pattern_description = None; + let mut copyable = false; + let mut masked = false; + let mut placeholder = None; + while let Some::(key) = map.next_key()? { + if &key == "pattern" { + if pattern.is_some() { + return Err(serde::de::Error::duplicate_field("pattern")); + } else { + pattern = Some( + Regex::new(&map.next_value::()?) + .map_err(serde::de::Error::custom)?, + ); + } + } else if &key == "pattern-description" { + if pattern_description.is_some() { + return Err(serde::de::Error::duplicate_field("pattern-description")); + } else { + pattern_description = Some(map.next_value()?); + } + } else if &key == "copyable" { + copyable = map.next_value()?; + } else if &key == "masked" { + masked = map.next_value()?; + } else if &key == "placeholder" { + if placeholder.is_some() { + return Err(serde::de::Error::duplicate_field("pattern")); + } else { + placeholder = Some(map.next_value()?); + } + } + } + let regex = match (pattern, pattern_description) { + (None, None) => None, + (Some(p), Some(d)) => Some(Pattern { + pattern: p, + pattern_description: d, + }), + (Some(_), None) => { + return Err(serde::de::Error::missing_field("pattern-description")); + } + (None, Some(_)) => { + return Err(serde::de::Error::missing_field("pattern")); + } + }; + Ok(ValueSpecString { + pattern: regex, + copyable, + masked, + placeholder, + }) + } + } + const FIELDS: &'static [&'static str] = &[ + "pattern", + "pattern-description", + "copyable", + "masked", + "placeholder", + ]; + deserializer.deserialize_struct("ValueSpecString", FIELDS, ValueSpecStringVisitor) + } +} #[async_trait] impl ValueSpec for ValueSpecString { fn matches(&self, value: &Value) -> Result<(), NoMatchWithPath> { @@ -2063,3 +2133,33 @@ impl ValueSpec for SystemPointerSpec { false } } + +#[test] +fn invalid_regex_produces_error() { + assert!( + serde_yaml::from_reader::<_, ConfigSpec>(std::io::Cursor::new(include_bytes!( + "../../test/config-spec/lnd-invalid-regex.yaml" + ))) + .is_err() + ) +} + +#[test] +fn missing_pattern_description_produces_error() { + assert!( + serde_yaml::from_reader::<_, ConfigSpec>(std::io::Cursor::new(include_bytes!( + "../../test/config-spec/lnd-missing-pattern-description.yaml" + ))) + .is_err() + ) +} + +#[test] +fn missing_pattern_produces_error() { + assert!( + serde_yaml::from_reader::<_, ConfigSpec>(std::io::Cursor::new(include_bytes!( + "../../test/config-spec/lnd-missing-pattern.yaml" + ))) + .is_err() + ) +} diff --git a/backend/test/config-spec/lnd-invalid-regex.yaml b/backend/test/config-spec/lnd-invalid-regex.yaml new file mode 100644 index 000000000..7bd6d677d --- /dev/null +++ b/backend/test/config-spec/lnd-invalid-regex.yaml @@ -0,0 +1,546 @@ +control-tor-address: + name: Control Tor Address + description: The Tor address for the control interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: control +peer-tor-address: + name: Peer Tor Address + description: The Tor address for the peer interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: peer +watchtower-tor-address: + name: Watchtower Tor Address + description: The Tor address for the watchtower interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: watchtower +alias: + type: string + name: Alias + description: The public, human-readable name of your Lightning node + nullable: true + pattern: ".{1,32}" + pattern-description: Must be at least 1 character and no more than 32 characters +color: + type: string + name: Color + description: The public color dot of your Lightning node + nullable: false + pattern: "[0-9a-fA-F]{6" + pattern-description: | + Must be a valid 6 digit hexadecimal RGB value. The first two digits are red, middle two are green, and final two are + blue + default: + charset: "a-f,0-9" + len: 6 +accept-keysend: + type: boolean + name: Accept Keysend + description: | + Allow others to send payments directly to your public key through keysend instead of having to get a new invoice + default: false +accept-amp: + type: boolean + name: Accept Spontaneous AMPs + description: | + If enabled, spontaneous payments through AMP will be accepted. Payments to AMP + invoices will be accepted regardless of this setting. + default: false +reject-htlc: + type: boolean + name: Reject Routing Requests + description: | + If true, LND will not forward any HTLCs that are meant as onward payments. This option will still allow LND to send + HTLCs and receive HTLCs but lnd won't be used as a hop. + default: false +min-chan-size: + type: number + name: Minimum Channel Size + description: | + The smallest channel size that we should accept. Incoming channels smaller than this will be rejected. + nullable: true + range: "[1,16777215]" + integral: true + units: satoshis +max-chan-size: + type: number + name: Maximum Channel Size + description: | + The largest channel size that we should accept. Incoming channels larger than this will be rejected. + For non-Wumbo channels this limit remains 16777215 satoshis by default as specified in BOLT-0002. For wumbo + channels this limit is 1,000,000,000 satoshis (10 BTC). Set this config option explicitly to restrict your maximum + channel size to better align with your risk tolerance. Don't forget to enable Wumbo channels under 'Advanced,' if desired. + nullable: true + range: "[1,1000000000]" + integral: true + units: satoshis +tor: + type: object + name: Tor Config + nullable: false + spec: + use-tor-only: + type: boolean + name: Use Tor for all traffic + description: >- + Use the tor proxy even for connections that are reachable on clearnet. This will hide your node's public IP + address, but will slow down your node's performance + nullable: false + default: false + stream-isolation: + type: boolean + name: Stream Isolation + description: >- + Enable Tor stream isolation by randomizing user credentials for each + connection. With this mode active, each connection will use a new circuit. + This means that multiple applications (other than lnd) using Tor won't be mixed + in with lnd's traffic. + + This option may not be used when 'Use Tor for all traffic' is disabled, since direct + connections compromise source IP privacy by default. + nullable: false + default: false +bitcoind: + type: union + name: Bitcoin Core + description: | + The Bitcoin Core node to connect to: + - internal: The Bitcoin Core and Proxy services installed to your Embassy + - external: An unpruned Bitcoin Core node running on a different device + tag: + id: type + name: Type + variant-names: + internal: Internal (Bitcoin Core) + internal-proxy: Internal (Bitcoin Proxy) + external: External + description: | + The Bitcoin Core node to connect to: + - internal: The Bitcoin Core and Proxy services installed to your Embassy + - external: An unpruned Bitcoin Core node running on a different device + default: internal + variants: + internal: + user: + type: pointer + name: RPC Username + description: The username for Bitcoin Core's RPC interface + subtype: package + package-id: bitcoind + target: config + multi: false + selector: "$.rpc.username" + password: + type: pointer + name: RPC Password + description: The password for Bitcoin Core's RPC interface + subtype: package + package-id: bitcoind + target: config + multi: false + selector: "$.rpc.password" + internal-proxy: + user: + type: pointer + name: RPC Username + description: The username for the RPC user allocated to lnd + subtype: package + package-id: btc-rpc-proxy + target: config + multi: false + selector: '$.users[?(@.name == "lnd")].name' + # index: 'users.[first(item => ''item.name = "lnd")].name' + password: + type: pointer + name: RPC Password + description: The password for the RPC user allocated to lnd + subtype: package + package-id: btc-rpc-proxy + target: config + multi: false + selector: '$.users[?(@.name == "lnd")].password' + # index: 'users.[first(item => ''item.name = "lnd")].password' + external: + connection-settings: + type: union + name: Connection Settings + description: Information to connect to an external unpruned Bitcoin Core node + tag: + id: type + name: Type + description: | + - Manual: Raw information for finding a Bitcoin Core node + - Quick Connect: A Quick Connect URL for a Bitcoin Core node + variant-names: + manual: Manual + quick-connect: Quick Connect + default: quick-connect + variants: + manual: + host: + type: string + name: Public Address + description: The public address of your Bitcoin Core server + nullable: false + rpc-user: + type: string + name: RPC Username + description: The username for the RPC user on your Bitcoin Core RPC server + nullable: false + rpc-password: + type: string + name: RPC Password + description: The password for the RPC user on your Bitcoin Core RPC server + nullable: false + rpc-port: + type: number + name: RPC Port + description: The port that your Bitcoin Core RPC server is bound to + nullable: false + range: "[0,65535]" + integral: true + default: 8332 + zmq-block-port: + type: number + name: ZeroMQ Block Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw blocks + nullable: false + range: "[0,65535]" + integral: true + default: 28332 + zmq-tx-port: + type: number + name: ZeroMQ Transaction Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw transactions + nullable: false + range: "[0,65535]" + integral: true + default: 28333 + quick-connect: + quick-connect-url: + type: string + name: Quick Connect URL + description: | + The Quick Connect URL for your Bitcoin Core RPC server + NOTE: LND will not accept a .onion url for this option + nullable: false + pattern: 'btcstandup://[^:]*:[^@]*@[a-zA-Z0-9.-]+:[0-9]+(/(\?(label=.+)?)?)?' + pattern-description: Must be a valid Quick Connect URL. For help, check out https://github.com/BlockchainCommons/Gordian/blob/master/Docs/Quick-Connect-API.md + zmq-block-port: + type: number + name: ZeroMQ Block Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw blocks + nullable: false + range: "[0,65535]" + integral: true + default: 28332 + zmq-tx-port: + type: number + name: ZeroMQ Transaction Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw transactions + nullable: false + range: "[0,65535]" + integral: true + default: 28333 +autopilot: + type: object + name: Autopilot + description: Autopilot Settings + nullable: false + spec: + enabled: + type: boolean + name: Enabled + description: | + If the autopilot agent should be active or not. The autopilot agent will + attempt to AUTOMATICALLY OPEN CHANNELS to put your node in an advantageous + position within the network graph. DO NOT ENABLE THIS IF YOU WANT TO MANAGE + CHANNELS MANUALLY OR DO NOT UNDERSTAND IT. + default: false + private: + type: boolean + name: Private + description: | + Whether the channels created by the autopilot agent should be private or not. + Private channels won't be announced to the network. + default: false + maxchannels: + type: number + name: Maximum Channels + description: The maximum number of channels that should be created. + nullable: false + range: "[1,*)" + integral: true + default: 5 + allocation: + type: number + name: Allocation + description: | + The fraction of total funds that should be committed to automatic channel + establishment. For example 60% means that 60% of the total funds available + within the wallet should be used to automatically establish channels. The total + amount of attempted channels will still respect the "Maximum Channels" parameter. + nullable: false + range: "[0,100]" + integral: false + default: 60 + units: "%" + min-channel-size: + type: number + name: Minimum Channel Size + description: The smallest channel that the autopilot agent should create. + nullable: false + range: "[0,*)" + integral: true + default: 20000 + units: "satoshis" + max-channel-size: + type: number + name: Maximum Channel Size + description: The largest channel that the autopilot agent should create. + nullable: false + range: "[0,*)" + integral: true + default: 16777215 + units: "satoshis" + advanced: + type: object + name: Advanced + description: Advanced Options + nullable: false + spec: + min-confirmations: + type: number + name: Minimum Confirmations + description: | + The minimum number of confirmations each of your inputs in funding transactions + created by the autopilot agent must have. + nullable: false + range: "[0,*)" + integral: true + default: 1 + units: blocks + confirmation-target: + type: number + name: Confirmation Target + description: The confirmation target (in blocks) for channels opened by autopilot. + nullable: false + range: "[0,*)" + integral: true + default: 1 + units: blocks +advanced: + type: object + name: Advanced + description: Advanced Options + nullable: false + spec: + debug-level: + type: enum + name: Log Verbosity + values: + - trace + - debug + - info + - warn + - error + - critical + description: | + Sets the level of log filtration. Trace is the most verbose, Critical is the least. + default: info + db-bolt-no-freelist-sync: + type: boolean + name: Disallow Bolt DB Freelist Sync + description: | + If true, prevents the database from syncing its freelist to disk. + default: false + db-bolt-auto-compact: + type: boolean + name: Compact Database on Startup + description: | + Performs database compaction on startup. This is necessary to keep disk usage down over time at the cost of + having longer startup times. + default: true + db-bolt-auto-compact-min-age: + type: number + name: Minimum Autocompaction Age for Bolt DB + description: | + How long ago (in hours) the last compaction of a database file must be for it to be considered for auto + compaction again. Can be set to 0 to compact on every startup. + nullable: false + range: "[0, *)" + integral: true + default: 168 + units: hours + db-bolt-db-timeout: + type: number + name: Bolt DB Timeout + description: How long should LND try to open the database before giving up? + nullable: false + range: "[1, 86400]" + integral: true + default: 60 + units: seconds + recovery-window: + type: number + name: Recovery Window + description: Number of blocks in the past that LND should scan for unknown transactions + nullable: true + range: "[1,*)" + integral: true + units: "blocks" + payments-expiration-grace-period: + type: number + name: Payments Expiration Grace Period + description: | + A period to wait before for closing channels with outgoing htlcs that have timed out and are a result of this + nodes instead payment. In addition to our current block based deadline, is specified this grace period will + also be taken into account. + nullable: false + range: "[1,*)" + integral: true + default: 30 + units: "seconds" + default-remote-max-htlcs: + type: number + name: Maximum Remote HTLCs + description: | + The default max_htlc applied when opening or accepting channels. This value limits the number of concurrent + HTLCs that the remote party can add to the commitment. The maximum possible value is 483. + nullable: false + range: "[1,483]" + integral: true + default: 483 + units: htlcs + max-channel-fee-allocation: + type: number + name: Maximum Channel Fee Allocation + description: | + The maximum percentage of total funds that can be allocated to a channel's commitment fee. This only applies for + the initiator of the channel. + nullable: false + range: "[0.1, 1]" + integral: false + default: 0.5 + max-commit-fee-rate-anchors: + type: number + name: Maximum Commitment Fee for Anchor Channels + description: | + The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be + large enough to ensure transaction propagation. + nullable: false + range: "[1,*)" + integral: true + default: 10 + protocol-wumbo-channels: + type: boolean + name: Enable Wumbo Channels + description: | + If set, then lnd will create and accept requests for channels larger than 0.16 BTC + nullable: false + default: false + protocol-no-anchors: + type: boolean + name: Disable Anchor Channels + description: | + Set to disable support for anchor commitments. Anchor channels allow you to determine your fees at close time by + using a Child Pays For Parent transaction. + nullable: false + default: false + protocol-disable-script-enforced-lease: + type: boolean + name: Disable Script Enforced Channel Leases + description: >- + Set to disable support for script enforced lease channel commitments. If not + set, lnd will accept these channels by default if the remote channel party + proposes them. Note that lnd will require 1 UTXO to be reserved for this + channel type if it is enabled. + + Note: This may cause you to be unable to close a channel and your wallets may not understand why + nullable: false + default: false + gc-canceled-invoices-on-startup: + type: boolean + name: Cleanup Canceled Invoices on Startup + description: | + If true, LND will attempt to garbage collect canceled invoices upon start. + nullable: false + default: false + bitcoin: + type: object + name: Bitcoin Channel Configuration + description: Configuration options for lightning network channel management operating over the Bitcoin network + nullable: false + spec: + default-channel-confirmations: + type: number + name: Default Channel Confirmations + description: | + The default number of confirmations a channel must have before it's considered + open. LND will require any incoming channel requests to wait this many + confirmations before it considers the channel active. + nullable: false + range: "[1,6]" + integral: true + default: 3 + units: "blocks" + min-htlc: + type: number + name: Minimum Incoming HTLC Size + description: | + The smallest HTLC LND will to accept on your channels, in millisatoshis. + nullable: false + range: "[1,*)" + integral: true + default: 1 + units: "millisatoshis" + min-htlc-out: + type: number + name: Minimum Outgoing HTLC Size + description: | + The smallest HTLC LND will send out on your channels, in millisatoshis. + nullable: false + range: "[1,*)" + integral: true + default: 1000 + units: "millisatoshis" + base-fee: + type: number + name: Routing Base Fee + description: | + The base fee in millisatoshi you will charge for forwarding payments on your + channels. + nullable: false + range: "[0,*)" + integral: true + default: 1000 + units: "millisatoshi" + fee-rate: + type: number + name: Routing Fee Rate + description: | + The fee rate used when forwarding payments on your channels. The total fee + charged is the Base Fee + (amount * Fee Rate / 1000000), where amount is the + forwarded amount. Measured in sats per million + nullable: false + range: "[1,1000000)" + integral: true + default: 1 + units: "sats per million" + time-lock-delta: + type: number + name: Time Lock Delta + description: The CLTV delta we will subtract from a forwarded HTLC's timelock value. + nullable: false + range: "[6, 144]" + integral: true + default: 40 + units: "blocks" diff --git a/backend/test/config-spec/lnd-missing-pattern-description.yaml b/backend/test/config-spec/lnd-missing-pattern-description.yaml new file mode 100644 index 000000000..50e8b9d01 --- /dev/null +++ b/backend/test/config-spec/lnd-missing-pattern-description.yaml @@ -0,0 +1,545 @@ +control-tor-address: + name: Control Tor Address + description: The Tor address for the control interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: control +peer-tor-address: + name: Peer Tor Address + description: The Tor address for the peer interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: peer +watchtower-tor-address: + name: Watchtower Tor Address + description: The Tor address for the watchtower interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: watchtower +alias: + type: string + name: Alias + description: The public, human-readable name of your Lightning node + nullable: true + pattern: ".{1,32}" + pattern-description: Must be at least 1 character and no more than 32 characters +color: + type: string + name: Color + description: The public color dot of your Lightning node + nullable: false + pattern: "[0-9a-fA-F]{6" + pattern-description: | + Must be a valid 6 digit hexadecimal RGB value. The first two digits are red, middle two are green, and final two are + blue + default: + charset: "a-f,0-9" + len: 6 +accept-keysend: + type: boolean + name: Accept Keysend + description: | + Allow others to send payments directly to your public key through keysend instead of having to get a new invoice + default: false +accept-amp: + type: boolean + name: Accept Spontaneous AMPs + description: | + If enabled, spontaneous payments through AMP will be accepted. Payments to AMP + invoices will be accepted regardless of this setting. + default: false +reject-htlc: + type: boolean + name: Reject Routing Requests + description: | + If true, LND will not forward any HTLCs that are meant as onward payments. This option will still allow LND to send + HTLCs and receive HTLCs but lnd won't be used as a hop. + default: false +min-chan-size: + type: number + name: Minimum Channel Size + description: | + The smallest channel size that we should accept. Incoming channels smaller than this will be rejected. + nullable: true + range: "[1,16777215]" + integral: true + units: satoshis +max-chan-size: + type: number + name: Maximum Channel Size + description: | + The largest channel size that we should accept. Incoming channels larger than this will be rejected. + For non-Wumbo channels this limit remains 16777215 satoshis by default as specified in BOLT-0002. For wumbo + channels this limit is 1,000,000,000 satoshis (10 BTC). Set this config option explicitly to restrict your maximum + channel size to better align with your risk tolerance. Don't forget to enable Wumbo channels under 'Advanced,' if desired. + nullable: true + range: "[1,1000000000]" + integral: true + units: satoshis +tor: + type: object + name: Tor Config + nullable: false + spec: + use-tor-only: + type: boolean + name: Use Tor for all traffic + description: >- + Use the tor proxy even for connections that are reachable on clearnet. This will hide your node's public IP + address, but will slow down your node's performance + nullable: false + default: false + stream-isolation: + type: boolean + name: Stream Isolation + description: >- + Enable Tor stream isolation by randomizing user credentials for each + connection. With this mode active, each connection will use a new circuit. + This means that multiple applications (other than lnd) using Tor won't be mixed + in with lnd's traffic. + + This option may not be used when 'Use Tor for all traffic' is disabled, since direct + connections compromise source IP privacy by default. + nullable: false + default: false +bitcoind: + type: union + name: Bitcoin Core + description: | + The Bitcoin Core node to connect to: + - internal: The Bitcoin Core and Proxy services installed to your Embassy + - external: An unpruned Bitcoin Core node running on a different device + tag: + id: type + name: Type + variant-names: + internal: Internal (Bitcoin Core) + internal-proxy: Internal (Bitcoin Proxy) + external: External + description: | + The Bitcoin Core node to connect to: + - internal: The Bitcoin Core and Proxy services installed to your Embassy + - external: An unpruned Bitcoin Core node running on a different device + default: internal + variants: + internal: + user: + type: pointer + name: RPC Username + description: The username for Bitcoin Core's RPC interface + subtype: package + package-id: bitcoind + target: config + multi: false + selector: "$.rpc.username" + password: + type: pointer + name: RPC Password + description: The password for Bitcoin Core's RPC interface + subtype: package + package-id: bitcoind + target: config + multi: false + selector: "$.rpc.password" + internal-proxy: + user: + type: pointer + name: RPC Username + description: The username for the RPC user allocated to lnd + subtype: package + package-id: btc-rpc-proxy + target: config + multi: false + selector: '$.users[?(@.name == "lnd")].name' + # index: 'users.[first(item => ''item.name = "lnd")].name' + password: + type: pointer + name: RPC Password + description: The password for the RPC user allocated to lnd + subtype: package + package-id: btc-rpc-proxy + target: config + multi: false + selector: '$.users[?(@.name == "lnd")].password' + # index: 'users.[first(item => ''item.name = "lnd")].password' + external: + connection-settings: + type: union + name: Connection Settings + description: Information to connect to an external unpruned Bitcoin Core node + tag: + id: type + name: Type + description: | + - Manual: Raw information for finding a Bitcoin Core node + - Quick Connect: A Quick Connect URL for a Bitcoin Core node + variant-names: + manual: Manual + quick-connect: Quick Connect + default: quick-connect + variants: + manual: + host: + type: string + name: Public Address + description: The public address of your Bitcoin Core server + nullable: false + rpc-user: + type: string + name: RPC Username + description: The username for the RPC user on your Bitcoin Core RPC server + nullable: false + rpc-password: + type: string + name: RPC Password + description: The password for the RPC user on your Bitcoin Core RPC server + nullable: false + rpc-port: + type: number + name: RPC Port + description: The port that your Bitcoin Core RPC server is bound to + nullable: false + range: "[0,65535]" + integral: true + default: 8332 + zmq-block-port: + type: number + name: ZeroMQ Block Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw blocks + nullable: false + range: "[0,65535]" + integral: true + default: 28332 + zmq-tx-port: + type: number + name: ZeroMQ Transaction Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw transactions + nullable: false + range: "[0,65535]" + integral: true + default: 28333 + quick-connect: + quick-connect-url: + type: string + name: Quick Connect URL + description: | + The Quick Connect URL for your Bitcoin Core RPC server + NOTE: LND will not accept a .onion url for this option + nullable: false + pattern: 'btcstandup://[^:]*:[^@]*@[a-zA-Z0-9.-]+:[0-9]+(/(\?(label=.+)?)?)?' + zmq-block-port: + type: number + name: ZeroMQ Block Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw blocks + nullable: false + range: "[0,65535]" + integral: true + default: 28332 + zmq-tx-port: + type: number + name: ZeroMQ Transaction Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw transactions + nullable: false + range: "[0,65535]" + integral: true + default: 28333 +autopilot: + type: object + name: Autopilot + description: Autopilot Settings + nullable: false + spec: + enabled: + type: boolean + name: Enabled + description: | + If the autopilot agent should be active or not. The autopilot agent will + attempt to AUTOMATICALLY OPEN CHANNELS to put your node in an advantageous + position within the network graph. DO NOT ENABLE THIS IF YOU WANT TO MANAGE + CHANNELS MANUALLY OR DO NOT UNDERSTAND IT. + default: false + private: + type: boolean + name: Private + description: | + Whether the channels created by the autopilot agent should be private or not. + Private channels won't be announced to the network. + default: false + maxchannels: + type: number + name: Maximum Channels + description: The maximum number of channels that should be created. + nullable: false + range: "[1,*)" + integral: true + default: 5 + allocation: + type: number + name: Allocation + description: | + The fraction of total funds that should be committed to automatic channel + establishment. For example 60% means that 60% of the total funds available + within the wallet should be used to automatically establish channels. The total + amount of attempted channels will still respect the "Maximum Channels" parameter. + nullable: false + range: "[0,100]" + integral: false + default: 60 + units: "%" + min-channel-size: + type: number + name: Minimum Channel Size + description: The smallest channel that the autopilot agent should create. + nullable: false + range: "[0,*)" + integral: true + default: 20000 + units: "satoshis" + max-channel-size: + type: number + name: Maximum Channel Size + description: The largest channel that the autopilot agent should create. + nullable: false + range: "[0,*)" + integral: true + default: 16777215 + units: "satoshis" + advanced: + type: object + name: Advanced + description: Advanced Options + nullable: false + spec: + min-confirmations: + type: number + name: Minimum Confirmations + description: | + The minimum number of confirmations each of your inputs in funding transactions + created by the autopilot agent must have. + nullable: false + range: "[0,*)" + integral: true + default: 1 + units: blocks + confirmation-target: + type: number + name: Confirmation Target + description: The confirmation target (in blocks) for channels opened by autopilot. + nullable: false + range: "[0,*)" + integral: true + default: 1 + units: blocks +advanced: + type: object + name: Advanced + description: Advanced Options + nullable: false + spec: + debug-level: + type: enum + name: Log Verbosity + values: + - trace + - debug + - info + - warn + - error + - critical + description: | + Sets the level of log filtration. Trace is the most verbose, Critical is the least. + default: info + db-bolt-no-freelist-sync: + type: boolean + name: Disallow Bolt DB Freelist Sync + description: | + If true, prevents the database from syncing its freelist to disk. + default: false + db-bolt-auto-compact: + type: boolean + name: Compact Database on Startup + description: | + Performs database compaction on startup. This is necessary to keep disk usage down over time at the cost of + having longer startup times. + default: true + db-bolt-auto-compact-min-age: + type: number + name: Minimum Autocompaction Age for Bolt DB + description: | + How long ago (in hours) the last compaction of a database file must be for it to be considered for auto + compaction again. Can be set to 0 to compact on every startup. + nullable: false + range: "[0, *)" + integral: true + default: 168 + units: hours + db-bolt-db-timeout: + type: number + name: Bolt DB Timeout + description: How long should LND try to open the database before giving up? + nullable: false + range: "[1, 86400]" + integral: true + default: 60 + units: seconds + recovery-window: + type: number + name: Recovery Window + description: Number of blocks in the past that LND should scan for unknown transactions + nullable: true + range: "[1,*)" + integral: true + units: "blocks" + payments-expiration-grace-period: + type: number + name: Payments Expiration Grace Period + description: | + A period to wait before for closing channels with outgoing htlcs that have timed out and are a result of this + nodes instead payment. In addition to our current block based deadline, is specified this grace period will + also be taken into account. + nullable: false + range: "[1,*)" + integral: true + default: 30 + units: "seconds" + default-remote-max-htlcs: + type: number + name: Maximum Remote HTLCs + description: | + The default max_htlc applied when opening or accepting channels. This value limits the number of concurrent + HTLCs that the remote party can add to the commitment. The maximum possible value is 483. + nullable: false + range: "[1,483]" + integral: true + default: 483 + units: htlcs + max-channel-fee-allocation: + type: number + name: Maximum Channel Fee Allocation + description: | + The maximum percentage of total funds that can be allocated to a channel's commitment fee. This only applies for + the initiator of the channel. + nullable: false + range: "[0.1, 1]" + integral: false + default: 0.5 + max-commit-fee-rate-anchors: + type: number + name: Maximum Commitment Fee for Anchor Channels + description: | + The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be + large enough to ensure transaction propagation. + nullable: false + range: "[1,*)" + integral: true + default: 10 + protocol-wumbo-channels: + type: boolean + name: Enable Wumbo Channels + description: | + If set, then lnd will create and accept requests for channels larger than 0.16 BTC + nullable: false + default: false + protocol-no-anchors: + type: boolean + name: Disable Anchor Channels + description: | + Set to disable support for anchor commitments. Anchor channels allow you to determine your fees at close time by + using a Child Pays For Parent transaction. + nullable: false + default: false + protocol-disable-script-enforced-lease: + type: boolean + name: Disable Script Enforced Channel Leases + description: >- + Set to disable support for script enforced lease channel commitments. If not + set, lnd will accept these channels by default if the remote channel party + proposes them. Note that lnd will require 1 UTXO to be reserved for this + channel type if it is enabled. + + Note: This may cause you to be unable to close a channel and your wallets may not understand why + nullable: false + default: false + gc-canceled-invoices-on-startup: + type: boolean + name: Cleanup Canceled Invoices on Startup + description: | + If true, LND will attempt to garbage collect canceled invoices upon start. + nullable: false + default: false + bitcoin: + type: object + name: Bitcoin Channel Configuration + description: Configuration options for lightning network channel management operating over the Bitcoin network + nullable: false + spec: + default-channel-confirmations: + type: number + name: Default Channel Confirmations + description: | + The default number of confirmations a channel must have before it's considered + open. LND will require any incoming channel requests to wait this many + confirmations before it considers the channel active. + nullable: false + range: "[1,6]" + integral: true + default: 3 + units: "blocks" + min-htlc: + type: number + name: Minimum Incoming HTLC Size + description: | + The smallest HTLC LND will to accept on your channels, in millisatoshis. + nullable: false + range: "[1,*)" + integral: true + default: 1 + units: "millisatoshis" + min-htlc-out: + type: number + name: Minimum Outgoing HTLC Size + description: | + The smallest HTLC LND will send out on your channels, in millisatoshis. + nullable: false + range: "[1,*)" + integral: true + default: 1000 + units: "millisatoshis" + base-fee: + type: number + name: Routing Base Fee + description: | + The base fee in millisatoshi you will charge for forwarding payments on your + channels. + nullable: false + range: "[0,*)" + integral: true + default: 1000 + units: "millisatoshi" + fee-rate: + type: number + name: Routing Fee Rate + description: | + The fee rate used when forwarding payments on your channels. The total fee + charged is the Base Fee + (amount * Fee Rate / 1000000), where amount is the + forwarded amount. Measured in sats per million + nullable: false + range: "[1,1000000)" + integral: true + default: 1 + units: "sats per million" + time-lock-delta: + type: number + name: Time Lock Delta + description: The CLTV delta we will subtract from a forwarded HTLC's timelock value. + nullable: false + range: "[6, 144]" + integral: true + default: 40 + units: "blocks" diff --git a/backend/test/config-spec/lnd-missing-pattern.yaml b/backend/test/config-spec/lnd-missing-pattern.yaml new file mode 100644 index 000000000..dce276b0c --- /dev/null +++ b/backend/test/config-spec/lnd-missing-pattern.yaml @@ -0,0 +1,545 @@ +control-tor-address: + name: Control Tor Address + description: The Tor address for the control interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: control +peer-tor-address: + name: Peer Tor Address + description: The Tor address for the peer interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: peer +watchtower-tor-address: + name: Watchtower Tor Address + description: The Tor address for the watchtower interface. + type: pointer + subtype: package + package-id: lnd + target: tor-address + interface: watchtower +alias: + type: string + name: Alias + description: The public, human-readable name of your Lightning node + nullable: true + pattern: ".{1,32}" + pattern-description: Must be at least 1 character and no more than 32 characters +color: + type: string + name: Color + description: The public color dot of your Lightning node + nullable: false + pattern: "[0-9a-fA-F]{6" + pattern-description: | + Must be a valid 6 digit hexadecimal RGB value. The first two digits are red, middle two are green, and final two are + blue + default: + charset: "a-f,0-9" + len: 6 +accept-keysend: + type: boolean + name: Accept Keysend + description: | + Allow others to send payments directly to your public key through keysend instead of having to get a new invoice + default: false +accept-amp: + type: boolean + name: Accept Spontaneous AMPs + description: | + If enabled, spontaneous payments through AMP will be accepted. Payments to AMP + invoices will be accepted regardless of this setting. + default: false +reject-htlc: + type: boolean + name: Reject Routing Requests + description: | + If true, LND will not forward any HTLCs that are meant as onward payments. This option will still allow LND to send + HTLCs and receive HTLCs but lnd won't be used as a hop. + default: false +min-chan-size: + type: number + name: Minimum Channel Size + description: | + The smallest channel size that we should accept. Incoming channels smaller than this will be rejected. + nullable: true + range: "[1,16777215]" + integral: true + units: satoshis +max-chan-size: + type: number + name: Maximum Channel Size + description: | + The largest channel size that we should accept. Incoming channels larger than this will be rejected. + For non-Wumbo channels this limit remains 16777215 satoshis by default as specified in BOLT-0002. For wumbo + channels this limit is 1,000,000,000 satoshis (10 BTC). Set this config option explicitly to restrict your maximum + channel size to better align with your risk tolerance. Don't forget to enable Wumbo channels under 'Advanced,' if desired. + nullable: true + range: "[1,1000000000]" + integral: true + units: satoshis +tor: + type: object + name: Tor Config + nullable: false + spec: + use-tor-only: + type: boolean + name: Use Tor for all traffic + description: >- + Use the tor proxy even for connections that are reachable on clearnet. This will hide your node's public IP + address, but will slow down your node's performance + nullable: false + default: false + stream-isolation: + type: boolean + name: Stream Isolation + description: >- + Enable Tor stream isolation by randomizing user credentials for each + connection. With this mode active, each connection will use a new circuit. + This means that multiple applications (other than lnd) using Tor won't be mixed + in with lnd's traffic. + + This option may not be used when 'Use Tor for all traffic' is disabled, since direct + connections compromise source IP privacy by default. + nullable: false + default: false +bitcoind: + type: union + name: Bitcoin Core + description: | + The Bitcoin Core node to connect to: + - internal: The Bitcoin Core and Proxy services installed to your Embassy + - external: An unpruned Bitcoin Core node running on a different device + tag: + id: type + name: Type + variant-names: + internal: Internal (Bitcoin Core) + internal-proxy: Internal (Bitcoin Proxy) + external: External + description: | + The Bitcoin Core node to connect to: + - internal: The Bitcoin Core and Proxy services installed to your Embassy + - external: An unpruned Bitcoin Core node running on a different device + default: internal + variants: + internal: + user: + type: pointer + name: RPC Username + description: The username for Bitcoin Core's RPC interface + subtype: package + package-id: bitcoind + target: config + multi: false + selector: "$.rpc.username" + password: + type: pointer + name: RPC Password + description: The password for Bitcoin Core's RPC interface + subtype: package + package-id: bitcoind + target: config + multi: false + selector: "$.rpc.password" + internal-proxy: + user: + type: pointer + name: RPC Username + description: The username for the RPC user allocated to lnd + subtype: package + package-id: btc-rpc-proxy + target: config + multi: false + selector: '$.users[?(@.name == "lnd")].name' + # index: 'users.[first(item => ''item.name = "lnd")].name' + password: + type: pointer + name: RPC Password + description: The password for the RPC user allocated to lnd + subtype: package + package-id: btc-rpc-proxy + target: config + multi: false + selector: '$.users[?(@.name == "lnd")].password' + # index: 'users.[first(item => ''item.name = "lnd")].password' + external: + connection-settings: + type: union + name: Connection Settings + description: Information to connect to an external unpruned Bitcoin Core node + tag: + id: type + name: Type + description: | + - Manual: Raw information for finding a Bitcoin Core node + - Quick Connect: A Quick Connect URL for a Bitcoin Core node + variant-names: + manual: Manual + quick-connect: Quick Connect + default: quick-connect + variants: + manual: + host: + type: string + name: Public Address + description: The public address of your Bitcoin Core server + nullable: false + rpc-user: + type: string + name: RPC Username + description: The username for the RPC user on your Bitcoin Core RPC server + nullable: false + rpc-password: + type: string + name: RPC Password + description: The password for the RPC user on your Bitcoin Core RPC server + nullable: false + rpc-port: + type: number + name: RPC Port + description: The port that your Bitcoin Core RPC server is bound to + nullable: false + range: "[0,65535]" + integral: true + default: 8332 + zmq-block-port: + type: number + name: ZeroMQ Block Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw blocks + nullable: false + range: "[0,65535]" + integral: true + default: 28332 + zmq-tx-port: + type: number + name: ZeroMQ Transaction Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw transactions + nullable: false + range: "[0,65535]" + integral: true + default: 28333 + quick-connect: + quick-connect-url: + type: string + name: Quick Connect URL + description: | + The Quick Connect URL for your Bitcoin Core RPC server + NOTE: LND will not accept a .onion url for this option + nullable: false + pattern-description: Must be a valid Quick Connect URL. For help, check out https://github.com/BlockchainCommons/Gordian/blob/master/Docs/Quick-Connect-API.md + zmq-block-port: + type: number + name: ZeroMQ Block Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw blocks + nullable: false + range: "[0,65535]" + integral: true + default: 28332 + zmq-tx-port: + type: number + name: ZeroMQ Transaction Port + description: The port that your Bitcoin Core ZeroMQ server is bound to for raw transactions + nullable: false + range: "[0,65535]" + integral: true + default: 28333 +autopilot: + type: object + name: Autopilot + description: Autopilot Settings + nullable: false + spec: + enabled: + type: boolean + name: Enabled + description: | + If the autopilot agent should be active or not. The autopilot agent will + attempt to AUTOMATICALLY OPEN CHANNELS to put your node in an advantageous + position within the network graph. DO NOT ENABLE THIS IF YOU WANT TO MANAGE + CHANNELS MANUALLY OR DO NOT UNDERSTAND IT. + default: false + private: + type: boolean + name: Private + description: | + Whether the channels created by the autopilot agent should be private or not. + Private channels won't be announced to the network. + default: false + maxchannels: + type: number + name: Maximum Channels + description: The maximum number of channels that should be created. + nullable: false + range: "[1,*)" + integral: true + default: 5 + allocation: + type: number + name: Allocation + description: | + The fraction of total funds that should be committed to automatic channel + establishment. For example 60% means that 60% of the total funds available + within the wallet should be used to automatically establish channels. The total + amount of attempted channels will still respect the "Maximum Channels" parameter. + nullable: false + range: "[0,100]" + integral: false + default: 60 + units: "%" + min-channel-size: + type: number + name: Minimum Channel Size + description: The smallest channel that the autopilot agent should create. + nullable: false + range: "[0,*)" + integral: true + default: 20000 + units: "satoshis" + max-channel-size: + type: number + name: Maximum Channel Size + description: The largest channel that the autopilot agent should create. + nullable: false + range: "[0,*)" + integral: true + default: 16777215 + units: "satoshis" + advanced: + type: object + name: Advanced + description: Advanced Options + nullable: false + spec: + min-confirmations: + type: number + name: Minimum Confirmations + description: | + The minimum number of confirmations each of your inputs in funding transactions + created by the autopilot agent must have. + nullable: false + range: "[0,*)" + integral: true + default: 1 + units: blocks + confirmation-target: + type: number + name: Confirmation Target + description: The confirmation target (in blocks) for channels opened by autopilot. + nullable: false + range: "[0,*)" + integral: true + default: 1 + units: blocks +advanced: + type: object + name: Advanced + description: Advanced Options + nullable: false + spec: + debug-level: + type: enum + name: Log Verbosity + values: + - trace + - debug + - info + - warn + - error + - critical + description: | + Sets the level of log filtration. Trace is the most verbose, Critical is the least. + default: info + db-bolt-no-freelist-sync: + type: boolean + name: Disallow Bolt DB Freelist Sync + description: | + If true, prevents the database from syncing its freelist to disk. + default: false + db-bolt-auto-compact: + type: boolean + name: Compact Database on Startup + description: | + Performs database compaction on startup. This is necessary to keep disk usage down over time at the cost of + having longer startup times. + default: true + db-bolt-auto-compact-min-age: + type: number + name: Minimum Autocompaction Age for Bolt DB + description: | + How long ago (in hours) the last compaction of a database file must be for it to be considered for auto + compaction again. Can be set to 0 to compact on every startup. + nullable: false + range: "[0, *)" + integral: true + default: 168 + units: hours + db-bolt-db-timeout: + type: number + name: Bolt DB Timeout + description: How long should LND try to open the database before giving up? + nullable: false + range: "[1, 86400]" + integral: true + default: 60 + units: seconds + recovery-window: + type: number + name: Recovery Window + description: Number of blocks in the past that LND should scan for unknown transactions + nullable: true + range: "[1,*)" + integral: true + units: "blocks" + payments-expiration-grace-period: + type: number + name: Payments Expiration Grace Period + description: | + A period to wait before for closing channels with outgoing htlcs that have timed out and are a result of this + nodes instead payment. In addition to our current block based deadline, is specified this grace period will + also be taken into account. + nullable: false + range: "[1,*)" + integral: true + default: 30 + units: "seconds" + default-remote-max-htlcs: + type: number + name: Maximum Remote HTLCs + description: | + The default max_htlc applied when opening or accepting channels. This value limits the number of concurrent + HTLCs that the remote party can add to the commitment. The maximum possible value is 483. + nullable: false + range: "[1,483]" + integral: true + default: 483 + units: htlcs + max-channel-fee-allocation: + type: number + name: Maximum Channel Fee Allocation + description: | + The maximum percentage of total funds that can be allocated to a channel's commitment fee. This only applies for + the initiator of the channel. + nullable: false + range: "[0.1, 1]" + integral: false + default: 0.5 + max-commit-fee-rate-anchors: + type: number + name: Maximum Commitment Fee for Anchor Channels + description: | + The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be + large enough to ensure transaction propagation. + nullable: false + range: "[1,*)" + integral: true + default: 10 + protocol-wumbo-channels: + type: boolean + name: Enable Wumbo Channels + description: | + If set, then lnd will create and accept requests for channels larger than 0.16 BTC + nullable: false + default: false + protocol-no-anchors: + type: boolean + name: Disable Anchor Channels + description: | + Set to disable support for anchor commitments. Anchor channels allow you to determine your fees at close time by + using a Child Pays For Parent transaction. + nullable: false + default: false + protocol-disable-script-enforced-lease: + type: boolean + name: Disable Script Enforced Channel Leases + description: >- + Set to disable support for script enforced lease channel commitments. If not + set, lnd will accept these channels by default if the remote channel party + proposes them. Note that lnd will require 1 UTXO to be reserved for this + channel type if it is enabled. + + Note: This may cause you to be unable to close a channel and your wallets may not understand why + nullable: false + default: false + gc-canceled-invoices-on-startup: + type: boolean + name: Cleanup Canceled Invoices on Startup + description: | + If true, LND will attempt to garbage collect canceled invoices upon start. + nullable: false + default: false + bitcoin: + type: object + name: Bitcoin Channel Configuration + description: Configuration options for lightning network channel management operating over the Bitcoin network + nullable: false + spec: + default-channel-confirmations: + type: number + name: Default Channel Confirmations + description: | + The default number of confirmations a channel must have before it's considered + open. LND will require any incoming channel requests to wait this many + confirmations before it considers the channel active. + nullable: false + range: "[1,6]" + integral: true + default: 3 + units: "blocks" + min-htlc: + type: number + name: Minimum Incoming HTLC Size + description: | + The smallest HTLC LND will to accept on your channels, in millisatoshis. + nullable: false + range: "[1,*)" + integral: true + default: 1 + units: "millisatoshis" + min-htlc-out: + type: number + name: Minimum Outgoing HTLC Size + description: | + The smallest HTLC LND will send out on your channels, in millisatoshis. + nullable: false + range: "[1,*)" + integral: true + default: 1000 + units: "millisatoshis" + base-fee: + type: number + name: Routing Base Fee + description: | + The base fee in millisatoshi you will charge for forwarding payments on your + channels. + nullable: false + range: "[0,*)" + integral: true + default: 1000 + units: "millisatoshi" + fee-rate: + type: number + name: Routing Fee Rate + description: | + The fee rate used when forwarding payments on your channels. The total fee + charged is the Base Fee + (amount * Fee Rate / 1000000), where amount is the + forwarded amount. Measured in sats per million + nullable: false + range: "[1,1000000)" + integral: true + default: 1 + units: "sats per million" + time-lock-delta: + type: number + name: Time Lock Delta + description: The CLTV delta we will subtract from a forwarded HTLC's timelock value. + nullable: false + range: "[6, 144]" + integral: true + default: 40 + units: "blocks"