Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/postgres-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: Check sparse feature sets
run: |
cargo check --no-default-features --features uniffi,chain-bitcoind,storage-postgres --verbose --color always
cargo test --lib --no-run --no-default-features --features chain-electrum,storage-postgres --verbose --color always
cargo check --test integration_tests_postgres --no-default-features --features chain-electrum,storage-postgres --verbose --color always
RUSTFLAGS="--cfg buggy_electrum_sync" cargo test --lib --no-run --no-default-features --features chain-electrum,storage-postgres --verbose --color always
RUSTFLAGS="--cfg buggy_electrum_sync" cargo check --test integration_tests_postgres --no-default-features --features chain-electrum,storage-postgres --verbose --color always
- name: Enable caching for bitcoind
id: cache-bitcoind
uses: actions/cache@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ jobs:
- name: Test on Rust ${{ matrix.toolchain }}
if: "matrix.platform != 'windows-latest'"
run: |
RUSTFLAGS="--cfg cycle_tests --cfg tokio_unstable" cargo test
RUSTFLAGS="--cfg cycle_tests --cfg tokio_unstable --cfg buggy_electrum_sync" cargo test --features chain-electrum
- name: Test with UniFFI support on Rust ${{ matrix.toolchain }}
if: "matrix.platform != 'windows-latest' && matrix.build-uniffi"
run: |
RUSTFLAGS="--cfg cycle_tests" cargo test --no-default-features --features uniffi-default
RUSTFLAGS="--cfg cycle_tests --cfg buggy_electrum_sync" cargo test --no-default-features --features uniffi-default,chain-electrum

linting:
name: Linting
Expand Down
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@
- `BalanceDetails::spendable_onchain_balance_sats` no longer includes wallet outputs selected
as inputs of a channel funding transaction or splice that has yet to confirm. They remain
part of `total_onchain_balance_sats` until the transaction is seen by a wallet sync. (#1037)
- Splices on zero-conf channels, e.g., with peers in `Config::trusted_peers_0conf` or LSPs
trusted for zero-conf, are no longer zero-conf themselves. Following LDK, a splice now
requires six confirmations before it locks, independent of the channel's own minimum depth.
This also applies to existing channels.
- An LSPS2 service now enforces the `max_client_to_self_delay` agreed upon in the selected
opening fee parameters when opening a JIT channel. If the client's `to_self_delay` exceeds it,
the channel open fails. LDK clients use a `to_self_delay` of 144 blocks by default, so a
service configured with a lower `LSPS2ServiceConfig::max_client_to_self_delay` will fail to
open JIT channels to them.
- The `chain-electrum` feature is no longer enabled by default, including in `uniffi-default`.
Following LDK, which considers its Electrum syncing unreliable for Lightning use, the Electrum
chain source is now only compiled when building with `RUSTFLAGS="--cfg buggy_electrum_sync"`
in addition to enabling `chain-electrum`.
- `Node::sign_message` now returns a `Result` and fails with `NodeError::MessageSigningFailed` if
the prefixed message would serialize as a signed gossip message, as LDK refuses to sign such
messages.

## Feature and API updates
- `Node::splice_out_max` withdraws the maximum available channel balance to an on-chain address.
Expand Down Expand Up @@ -101,8 +117,8 @@
`Node::splice_in_with_all` without spending the anchor reserve or failing for lack of a change
output. The splice now spends the wallet's confirmed UTXOs in full, so a bump is paid by adding
less to the channel, and any required anchor reserve is kept as a fixed output back to the
wallet. A bump past the splice's maximum feerate rebuilds it from all confirmed funds,
including coins confirmed since. (#1168)
wallet. If adding less would leave less than dust to add, the bump instead rebuilds the
splice from all confirmed funds, including coins confirmed since. (#1168)
- Building a fresh node against a Bitcoin Core RPC or REST chain source that fails to return the
current chain tip now aborts with a new `BuildError::ChainTipFetchFailed` variant instead of
silently pinning the wallet birthday to genesis, which would have forced a full-history rescan
Expand Down
35 changes: 18 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ panic = 'abort' # Abort on panic
[features]
default = [
"chain-esplora",
"chain-electrum",
"chain-bitcoind",
"storage-sqlite",
"storage-filesystem",
Expand All @@ -45,6 +44,8 @@ chain-esplora = [
"lightning-transaction-sync/esplora-async-https",
"lightning-transaction-sync/time",
]
# Requires building with `RUSTFLAGS="--cfg buggy_electrum_sync"`, as LDK only provides Electrum
# syncing behind that flag. Without it, the Electrum chain source is not compiled.
chain-electrum = [
"dep:bdk_electrum",
"dep:electrum-client",
Expand All @@ -66,7 +67,6 @@ uniffi = ["dep:uniffi"]
uniffi-default = [
"uniffi",
"chain-esplora",
"chain-electrum",
"storage-sqlite",
"storage-vss",
"unified-payments",
Expand All @@ -86,18 +86,18 @@ uniffi-default = [
#lightning-macros = { version = "0.2.0" }
#lightning-dns-resolver = { version = "0.3.0" }

lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std"] }
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" }
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std"] }
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" }
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["tokio"], optional = true }
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" }
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" }
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["rest-client", "rpc-client", "tokio"], optional = true }
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", optional = true }
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std"] }
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" }
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", optional = true }
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["std"] }
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6" }
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["std"] }
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6" }
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["tokio"], optional = true }
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6" }
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6" }
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["rest-client", "rpc-client", "tokio"], optional = true }
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", optional = true }
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["std"] }
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6" }
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", optional = true }

bdk_chain = { version = "0.23.3", default-features = false, features = ["std"] }
bdk_esplora = { version = "0.22.2", default-features = false, features = ["async-https-rustls", "tokio"], optional = true }
Expand Down Expand Up @@ -132,14 +132,14 @@ postgres-native-tls = { version = "0.5", default-features = false, features = ["
vss-client = { package = "vss-client-ng", version = "0.6", optional = true }
prost = { version = "0.11.6", default-features = false, optional = true}
#bitcoin-payment-instructions = { version = "0.6" }
bitcoin-payment-instructions = { git = "https://github.com/benthecarman/bitcoin-payment-instructions", rev = "3dbe11bdf8916639df42476501fb40f87b253e84", optional = true }
bitcoin-payment-instructions = { git = "https://github.com/benthecarman/bitcoin-payment-instructions", rev = "f94a645161c24dcbe09eac5a62925a207701c588", optional = true }

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["winbase"] }

[dev-dependencies]
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std", "_test_utils"] }
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["tokio"] }
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["std", "_test_utils"] }
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "faf1e513b8e58acba9cd6c6d18d538d27aee1de6", features = ["tokio"] }
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
proptest = "1.0.0"
regex = "1.5.6"
Expand Down Expand Up @@ -181,6 +181,7 @@ check-cfg = [
"cfg(cycle_tests)",
"cfg(hrn_tests)",
"cfg(zero_fee_commitment_tests)",
"cfg(buggy_electrum_sync)",
]

[[bench]]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ LDK Node's optional dependencies are grouped by the functionality they provide:
| Feature | Functionality |
| --- | --- |
| `chain-esplora` | Esplora chain source |
| `chain-electrum` | Electrum chain source |
| `chain-electrum` | Electrum chain source; also requires `RUSTFLAGS="--cfg buggy_electrum_sync"` |
| `chain-bitcoind` | Bitcoin Core RPC and REST chain source |
| `storage-sqlite` | SQLite storage |
| `storage-filesystem` | Filesystem storage |
Expand Down
2 changes: 2 additions & 0 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ interface Node {
sequence<PeerDetails> list_peers();
sequence<ChannelDetails> list_channels();
NetworkGraph network_graph();
[Throws=NodeError]
string sign_message([ByRef]sequence<u8> msg);
boolean verify_signature([ByRef]sequence<u8> msg, [ByRef]string sig, [ByRef]PublicKey pkey);
[Throws=NodeError]
Expand Down Expand Up @@ -175,6 +176,7 @@ enum NodeError {
"WalletOperationTimeout",
"PayerProofCreationFailed",
"OnchainTxSigningFailed",
"MessageSigningFailed",
"TxSyncFailed",
"TxSyncTimeout",
"GossipUpdateFailed",
Expand Down
20 changes: 12 additions & 8 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ use vss_client::headers::VssHeaderProvider;
use crate::chain::ChainSource;
#[cfg(feature = "chain-bitcoind")]
use crate::config::BitcoindRestClientConfig;
#[cfg(all(feature = "chain-electrum", buggy_electrum_sync))]
use crate::config::ElectrumSyncConfig;
use crate::config::{
default_user_config, may_announce_channel, AnnounceError, AsyncPaymentsRole, Config,
ElectrumSyncConfig, EsploraSyncConfig, HRNResolverConfig, TorConfig,
CHANNEL_TX_FACTS_CACHE_CAPACITY, CHANNEL_TX_FACTS_CACHE_WARMUP_COUNT,
DEFAULT_ESPLORA_SERVER_URL, DEFAULT_LOG_FILENAME, DEFAULT_LOG_LEVEL, PAYMENT_CACHE_CAPACITY,
PAYMENT_CACHE_WARMUP_COUNT,
EsploraSyncConfig, HRNResolverConfig, TorConfig, CHANNEL_TX_FACTS_CACHE_CAPACITY,
CHANNEL_TX_FACTS_CACHE_WARMUP_COUNT, DEFAULT_ESPLORA_SERVER_URL, DEFAULT_LOG_FILENAME,
DEFAULT_LOG_LEVEL, PAYMENT_CACHE_CAPACITY, PAYMENT_CACHE_WARMUP_COUNT,
};
use crate::connection::ConnectionManager;
use crate::data_store::{KeepAllEntries, KeepLeastRecentlyUsed};
Expand Down Expand Up @@ -130,7 +131,7 @@ enum ChainDataSourceConfig {
headers: HashMap<String, String>,
sync_config: Option<EsploraSyncConfig>,
},
#[cfg(feature = "chain-electrum")]
#[cfg(all(feature = "chain-electrum", buggy_electrum_sync))]
Electrum { server_url: String, sync_config: Option<ElectrumSyncConfig> },
#[cfg(feature = "chain-bitcoind")]
Bitcoind {
Expand Down Expand Up @@ -433,7 +434,7 @@ impl NodeBuilder {
///
/// If no `sync_config` is given, default values are used. See [`ElectrumSyncConfig`] for more
/// information.
#[cfg(feature = "chain-electrum")]
#[cfg(all(feature = "chain-electrum", buggy_electrum_sync))]
pub fn set_chain_source_electrum(
&mut self, server_url: String, sync_config: Option<ElectrumSyncConfig>,
) -> &mut Self {
Expand Down Expand Up @@ -1099,7 +1100,7 @@ impl Builder {
}
}

#[cfg(all(feature = "uniffi", feature = "chain-electrum"))]
#[cfg(all(feature = "uniffi", feature = "chain-electrum", buggy_electrum_sync))]
#[uniffi::export]
impl Builder {
/// Configures the [`Node`] instance to source its chain data from the given Electrum server.
Expand Down Expand Up @@ -1691,7 +1692,7 @@ fn build_with_store_internal(
)
.map_err(|()| BuildError::ChainSourceSetupFailed)?
},
#[cfg(feature = "chain-electrum")]
#[cfg(all(feature = "chain-electrum", buggy_electrum_sync))]
Some(ChainDataSourceConfig::Electrum { server_url, sync_config }) => {
let sync_config = sync_config.unwrap_or(ElectrumSyncConfig::default());
ChainSource::new_electrum(
Expand Down Expand Up @@ -2723,6 +2724,9 @@ pub(crate) fn optionally_install_rustls_cryptoprovider() {
INIT_CRYPTO.call_once(|| {
// Ensure we always install a `CryptoProvider` for `rustls` if it was somehow not previously installed by now.
if rustls::crypto::CryptoProvider::get_default().is_none() {
// rustls 0.23.48 deprecates the `ring` provider for lacking post-quantum key exchange,
// but it remains the backend our dependencies are built with.
#[allow(deprecated)]
let _ = rustls::crypto::ring::default_provider().install_default();
}

Expand Down
Loading
Loading