Skip to content

Commit 9e0a812

Browse files
authored
Merge pull request #835 from tnull/2026-03-improve-docs
Improve `Builder` and `Config` docs
2 parents 804f00f + c6308fb commit 9e0a812

File tree

3 files changed

+76
-10
lines changed

3 files changed

+76
-10
lines changed

src/builder.rs

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,40 @@ impl std::error::Error for BuildError {}
236236
/// the getgo.
237237
///
238238
/// ### Defaults
239-
/// - Wallet entropy is sourced from a `keys_seed` file located under [`Config::storage_dir_path`]
239+
/// - See [`Config`] for the default values of all configuration options.
240240
/// - Chain data is sourced from the Esplora endpoint `https://blockstream.info/api`
241241
/// - Gossip data is sourced via the peer-to-peer network
242+
/// - Logs are written to the filesystem (see [Logging] below)
243+
///
244+
/// ### Storage
245+
///
246+
/// Several `build` methods are available depending on the desired storage backend:
247+
/// - [`build`] uses an SQLite database (recommended default).
248+
/// - [`build_with_fs_store`] uses a filesystem-based store.
249+
/// - [`build_with_vss_store`] and variants use a [VSS] remote store (**experimental**).
250+
/// - [`build_with_store`] allows providing a custom [`KVStore`] implementation.
251+
///
252+
/// ### Logging
253+
///
254+
/// By default, logs are written to the filesystem via an internal file logger at
255+
/// [`DEFAULT_LOG_LEVEL`]. The log file path and level can be customized via
256+
/// [`set_filesystem_logger`].
257+
///
258+
/// Alternatively, logs can be written to the [`log`] facade via [`set_log_facade_logger`], or to
259+
/// a custom [`LogWriter`] via [`set_custom_logger`].
260+
///
261+
/// [`build`]: Self::build
262+
/// [`build_with_fs_store`]: Self::build_with_fs_store
263+
/// [`build_with_vss_store`]: Self::build_with_vss_store
264+
/// [`build_with_store`]: Self::build_with_store
265+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
266+
/// [`KVStore`]: lightning::util::persist::KVStore
267+
/// [`DEFAULT_LOG_LEVEL`]: crate::config::DEFAULT_LOG_LEVEL
268+
/// [`set_filesystem_logger`]: Self::set_filesystem_logger
269+
/// [`set_log_facade_logger`]: Self::set_log_facade_logger
270+
/// [`set_custom_logger`]: Self::set_custom_logger
271+
/// [`log`]: https://crates.io/crates/log
272+
/// [Logging]: #logging
242273
#[derive(Debug)]
243274
pub struct NodeBuilder {
244275
config: Config,
@@ -472,6 +503,10 @@ impl NodeBuilder {
472503
/// If set, the `max_log_level` sets the maximum log level. Otherwise, the latter defaults to
473504
/// [`DEFAULT_LOG_LEVEL`].
474505
///
506+
/// **Note:** Log rotation and pruning are the responsibility of the user and are not handled
507+
/// internally. For example, UNIX system tooling such as `logrotate` and `cron` can be used to
508+
/// manage log file sizes and retention.
509+
///
475510
/// [`DEFAULT_LOG_FILENAME`]: crate::config::DEFAULT_LOG_FILENAME
476511
pub fn set_filesystem_logger(
477512
&mut self, log_file_path: Option<String>, max_log_level: Option<LogLevel>,
@@ -764,9 +799,41 @@ impl NodeBuilder {
764799
/// the getgo.
765800
///
766801
/// ### Defaults
767-
/// - Wallet entropy is sourced from a `keys_seed` file located under [`Config::storage_dir_path`]
802+
/// - See [`Config`] for the default values of all configuration options.
768803
/// - Chain data is sourced from the Esplora endpoint `https://blockstream.info/api`
769804
/// - Gossip data is sourced via the peer-to-peer network
805+
/// - Logs are written to the filesystem (see [Logging] below)
806+
///
807+
/// ### Storage
808+
///
809+
/// Several `build` methods are available depending on the desired storage backend:
810+
/// - [`build`] uses an SQLite database (recommended default).
811+
/// - [`build_with_fs_store`] uses a filesystem-based store.
812+
/// - [`build_with_vss_store`] and variants use a [VSS] remote store (**experimental**).
813+
/// - [`build_with_store`] allows providing a custom [`KVStore`] implementation.
814+
///
815+
/// ### Logging
816+
///
817+
/// By default, logs are written to the filesystem via an internal file logger at
818+
/// [`DEFAULT_LOG_LEVEL`]. The log file path and level can be customized via
819+
/// [`set_filesystem_logger`].
820+
///
821+
/// Alternatively, logs can be written to the [`log`] facade via [`set_log_facade_logger`], or to
822+
/// a custom [`LogWriter`] via [`set_custom_logger`].
823+
///
824+
/// [`build`]: Self::build
825+
/// [`build_with_fs_store`]: Self::build_with_fs_store
826+
/// [`build_with_vss_store`]: Self::build_with_vss_store
827+
/// [`build_with_store`]: Self::build_with_store
828+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
829+
/// [`KVStore`]: lightning::util::persist::KVStore
830+
/// [`DEFAULT_LOG_LEVEL`]: crate::config::DEFAULT_LOG_LEVEL
831+
/// [`set_filesystem_logger`]: Self::set_filesystem_logger
832+
/// [`set_log_facade_logger`]: Self::set_log_facade_logger
833+
/// [`set_custom_logger`]: Self::set_custom_logger
834+
/// [`log`]: https://crates.io/crates/log
835+
/// [Logging]: #logging
836+
/// [Storage]: #storage
770837
#[derive(Debug)]
771838
#[cfg(feature = "uniffi")]
772839
pub struct ArcedNodeBuilder {
@@ -937,6 +1004,10 @@ impl ArcedNodeBuilder {
9371004
/// If set, the `max_log_level` sets the maximum log level. Otherwise, the latter defaults to
9381005
/// [`DEFAULT_LOG_LEVEL`].
9391006
///
1007+
/// **Note:** Log rotation and pruning are the responsibility of the user and are not handled
1008+
/// internally. For example, UNIX system tooling such as `logrotate` and `cron` can be used to
1009+
/// manage log file sizes and retention.
1010+
///
9401011
/// [`DEFAULT_LOG_FILENAME`]: crate::config::DEFAULT_LOG_FILENAME
9411012
pub fn set_filesystem_logger(
9421013
&self, log_file_path: Option<String>, log_level: Option<LogLevel>,

src/config.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,12 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
119119
/// | Parameter | Value |
120120
/// |----------------------------------------|--------------------|
121121
/// | `storage_dir_path` | /tmp/ldk_node/ |
122-
/// | `log_dir_path` | None |
123122
/// | `network` | Bitcoin |
124123
/// | `listening_addresses` | None |
124+
/// | `announcement_addresses` | None |
125125
/// | `node_alias` | None |
126-
/// | `default_cltv_expiry_delta` | 144 |
127-
/// | `onchain_wallet_sync_interval_secs` | 80 |
128-
/// | `wallet_sync_interval_secs` | 30 |
129-
/// | `fee_rate_cache_update_interval_secs` | 600 |
130126
/// | `trusted_peers_0conf` | [] |
131127
/// | `probing_liquidity_limit_multiplier` | 3 |
132-
/// | `log_level` | Debug |
133128
/// | `anchor_channels_config` | Some(..) |
134129
/// | `route_parameters` | None |
135130
/// | `tor_config` | None |
@@ -273,7 +268,7 @@ pub struct AnchorChannelsConfig {
273268
/// [`AnchorChannelsConfig::trusted_peers_no_reserve`], we will always try to spend the Anchor
274269
/// outputs with *any* on-chain funds available, i.e., the total reserve value as well as any
275270
/// spendable funds available in the on-chain wallet. Therefore, this per-channel multiplier is
276-
/// really a emergency reserve that we maintain at all time to reduce reduce the risk of
271+
/// really an emergency reserve that we maintain at all time to reduce the risk of
277272
/// insufficient funds at time of a channel closure. To this end, we will refuse to open
278273
/// outbound or accept inbound channels if we don't have sufficient on-chain funds available to
279274
/// cover the additional reserve requirement.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! A ready-to-go Lightning node library built using [LDK](https://lightningdevkit.org/) and
1212
//! [BDK](https://bitcoindevkit.org/).
1313
//!
14-
//! LDK Node is a non-custodial Lightning node in library form. Its central goal is to provide a
14+
//! LDK Node is a self-custodial Lightning node in library form. Its central goal is to provide a
1515
//! small, simple, and straightforward interface that enables users to easily set up and run a
1616
//! Lightning node with an integrated on-chain wallet. While minimalism is at its core, LDK Node
1717
//! aims to be sufficiently modular and configurable to be useful for a variety of use cases.

0 commit comments

Comments
 (0)