Skip to content

Introduce Rust features - #1061

Open
tnull wants to merge 17 commits into
lightningdevkit:mainfrom
tnull:2026-08-rust-features
Open

Introduce Rust features#1061
tnull wants to merge 17 commits into
lightningdevkit:mainfrom
tnull:2026-08-rust-features

Conversation

@tnull

@tnull tnull commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #900

Previously, we omitted making use of Rust features to dis-/enable specific functionality, with the exception of uniffi and most recently adding a tentative postgres feature.

Here we finally change that and allow users to selectively disable and enable specific parts of the code base, hence also reducing their dependency tree.

@tnull tnull added this to the 0.8 milestone Aug 19, 2026
@tnull
tnull requested a review from benthecarman August 19, 2026 12:35
@ldk-reviews-bot

ldk-reviews-bot commented Aug 19, 2026

Copy link
Copy Markdown

👋 Thanks for assigning @benthecarman as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull
tnull force-pushed the 2026-08-rust-features branch from 9b4022f to 7f339e5 Compare August 19, 2026 13:40

@benthecarman benthecarman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be good to have CI cover the missed feature configs that claude caught

Comment thread src/lib.rs
feature = "chain-electrum",
feature = "chain-bitcoind"
)))]
compile_error!("at least one chain source feature must be enabled");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should do same with db

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We can't do it exactly the same as we also support supplying a custom store via build_with_store, so can't enforce at compile time.

Comment thread bindings/ldk_node.udl
Comment thread src/chain/mod.rs
Comment thread src/wallet/mod.rs
Comment thread tests/common/mod.rs
Comment thread src/io/fs_store.rs Outdated
Comment thread src/io/fs_store.rs Outdated
tnull added 17 commits August 20, 2026 12:04
Allow integration runs to constrain randomized chain sources through
the LDK_NODE_TEST_CHAIN_SOURCES environment variable.

This makes backend-specific feature builds deterministic while
preserving all-backend randomization by default.

Co-Authored-By: HAL 9000
Let tests with custom node construction reuse the common chain source
configuration.

Co-Authored-By: HAL 9000
Exercise PostgreSQL-backed nodes with the configured or randomly
selected chain backend instead of always using Esplora.

Co-Authored-By: HAL 9000
Keep filesystem-specific code together so generic storage utilities can
compile without that backend. This commit only relocates the existing
migration behavior and tests.

Co-Authored-By: HAL 9000
Hide the concrete Bitcoin Core gossip verifier behind the LDK UTXO
lookup trait. This lets common gossip types compile independently of
the Bitcoin Core backend without changing verification behavior.

Co-Authored-By: HAL 9000
Keep human-readable-name resolution beside the unified payment code
that consumes it. This commit only relocates the existing resolver and
updates its internal import paths.

Co-Authored-By: HAL 9000
Define the cfg-selected Builder name next to the implementation it
represents. Feature-specific binding exports can now live there without
changing the native and lock-wrapped builder APIs.

Co-Authored-By: HAL 9000
Keep the native defaults while letting applications select only required
chain sources, storage backends, and unified payment support.
At least one chain source remains mandatory.
PostgreSQL now has a storage-prefixed feature name.

Co-Authored-By: HAL 9000
Keep custom UniFFI builds from requiring VSS and unified payment
dependencies that they did not enable.

Co-Authored-By: HAL 9000
Let wallet and PostgreSQL test targets compile when Esplora or
SQLite support is disabled.

Co-Authored-By: HAL 9000
Separate backend-specific binding methods into cfg-gated implementation
blocks. Method bodies and availability remain unchanged, making later
conditional exports easier to review.

Co-Authored-By: HAL 9000
Keep binding signatures and documentation next to their Rust
implementations. Leave only the UDL object declaration so backend
features can add methods without failure stubs.

Co-Authored-By: HAL 9000
Build published bindings with uniffi-default and without native
default features. Let local builds add backend features through
LDK_NODE_EXTRA_FEATURES.

Co-Authored-By: HAL 9000
Build and test UniFFI with its lean preset so excluded backends stay
excluded. Check all features and test targets to catch incompatible
optional dependencies without running the suite twice.

Co-Authored-By: HAL 9000
Cover custom UniFFI builds, non-Esplora wallet tests, and
PostgreSQL tests without SQLite in CI.

Co-Authored-By: HAL 9000
List each chain, storage, payment, and binding feature and explain
the unchanged native defaults. Show both lean and custom binding builds
so optional backend dependencies can be selected deliberately.

Co-Authored-By: HAL 9000
Avoid allocating paths before filesystem operations that only need
borrowed paths.

Co-Authored-By: HAL 9000
@tnull
tnull force-pushed the 2026-08-rust-features branch from 7f339e5 to 3185f51 Compare August 20, 2026 11:07
@tnull
tnull requested a review from benthecarman August 20, 2026 11:12
@tnull

tnull commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased to address minor conflicts, let me know if I can squash fixups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce Rust features

3 participants