Skip to content

Commit ba0c7e8

Browse files
committed
Launch VSS, remove cfg flag for it.
1 parent 5eee52e commit ba0c7e8

File tree

5 files changed

+49
-24
lines changed

5 files changed

+49
-24
lines changed

.github/workflows/vss-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474
run: |
7575
cd ldk-node
7676
export TEST_VSS_BASE_URL="http://localhost:8080/vss"
77-
RUSTFLAGS="--cfg vss_test --cfg vss" cargo build --verbose --color always
78-
RUSTFLAGS="--cfg vss_test --cfg vss" cargo test --test integration_tests_vss
77+
RUSTFLAGS="--cfg vss_test" cargo build --verbose --color always
78+
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss
7979
8080
- name: Cleanup
8181
run: |

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ esplora-client = { version = "0.9", default-features = false }
7272
libc = "0.2"
7373
uniffi = { version = "0.26.0", features = ["build"], optional = true }
7474

75-
[target.'cfg(vss)'.dependencies]
7675
vss-client = "0.3"
7776
prost = { version = "0.11.6", default-features = false}
7877

@@ -109,7 +108,6 @@ panic = "abort"
109108
level = "forbid"
110109
# When adding a new cfg attribute, ensure that it is added to this list.
111110
check-cfg = [
112-
"cfg(vss)",
113111
"cfg(vss_test)",
114112
"cfg(ldk_bench)",
115113
"cfg(tokio_unstable)",

src/builder.rs

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::fee_estimator::OnchainFeeEstimator;
1414
use crate::gossip::GossipSource;
1515
use crate::io::sqlite_store::SqliteStore;
1616
use crate::io::utils::{read_node_metrics, write_node_metrics};
17-
#[cfg(any(vss, vss_test))]
1817
use crate::io::vss_store::VssStore;
1918
use crate::liquidity::LiquiditySource;
2019
use crate::logger::{log_error, log_info, FilesystemLogger, Logger};
@@ -30,7 +29,6 @@ use crate::wallet::persist::KVStoreWalletPersister;
3029
use crate::wallet::Wallet;
3130
use crate::{io, NodeMetrics};
3231
use crate::{LogLevel, Node};
33-
#[cfg(any(vss, vss_test))]
3432
use std::collections::HashMap;
3533

3634
use lightning::chain::{chainmonitor, BestBlock, Watch};
@@ -66,7 +64,6 @@ use bip39::Mnemonic;
6664
use bitcoin::secp256k1::PublicKey;
6765
use bitcoin::{BlockHash, Network};
6866

69-
#[cfg(any(vss, vss_test))]
7067
use bitcoin::bip32::{ChildNumber, Xpriv};
7168
use std::convert::TryInto;
7269
use std::default::Default;
@@ -76,7 +73,6 @@ use std::path::PathBuf;
7673
use std::sync::atomic::AtomicBool;
7774
use std::sync::{Arc, Mutex, RwLock};
7875
use std::time::SystemTime;
79-
#[cfg(any(vss, vss_test))]
8076
use vss_client::headers::{FixedHeaders, LnurlAuthToJwtProvider, VssHeaderProvider};
8177

8278
#[derive(Debug, Clone)]
@@ -361,9 +357,14 @@ impl NodeBuilder {
361357
self.build_with_store(kv_store)
362358
}
363359

364-
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
360+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
365361
/// previously configured. Uses LnurlAuth as default method for authentication/authorization.
366-
#[cfg(any(vss, vss_test))]
362+
///
363+
/// **Caution**: [VSS] support is in **alpha**. Using [VSS] (or any remote persistence) may
364+
/// cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved
365+
/// after internal retries are exhausted.
366+
///
367+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
367368
pub fn build_with_vss_store(
368369
&self, vss_url: String, store_id: String, lnurl_auth_server_url: String,
369370
fixed_headers: HashMap<String, String>,
@@ -401,9 +402,14 @@ impl NodeBuilder {
401402
self.build_with_vss_store_and_header_provider(vss_url, store_id, header_provider)
402403
}
403404

404-
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
405+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
405406
/// previously configured. Uses only FixedHeaders as default method for authentication/authorization.
406-
#[cfg(any(vss, vss_test))]
407+
///
408+
/// **Caution**: [VSS] support is in **alpha**. Using [VSS] (or any remote persistence) may
409+
/// cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved
410+
/// after internal retries are exhausted.
411+
///
412+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
407413
pub fn build_with_vss_store_with_fixed_headers(
408414
&self, vss_url: String, store_id: String, fixed_headers: HashMap<String, String>,
409415
) -> Result<Node, BuildError> {
@@ -412,10 +418,16 @@ impl NodeBuilder {
412418
self.build_with_vss_store_and_header_provider(vss_url, store_id, header_provider)
413419
}
414420

415-
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
416-
/// previously configured. Give `header_provider` is used to attach headers to every request made
417-
/// to [VSS](https://github.com/lightningdevkit/vss-server/blob/main/README.md) backend.
418-
#[cfg(any(vss, vss_test))]
421+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
422+
/// previously configured. Given `header_provider` is used to attach headers to every request made
423+
/// to the [VSS] backend.
424+
///
425+
/// **Caution**: [VSS] support
426+
/// is in **alpha**. Using [VSS] (or any remote persistence) may cause LDK to panic if persistence
427+
/// failures are unrecoverable, i.e., if they remain unresolved after internal retries are
428+
/// exhausted.
429+
///
430+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
419431
pub fn build_with_vss_store_and_header_provider(
420432
&self, vss_url: String, store_id: String, header_provider: Arc<dyn VssHeaderProvider>,
421433
) -> Result<Node, BuildError> {
@@ -445,7 +457,6 @@ impl NodeBuilder {
445457
)
446458
}
447459

448-
#[cfg(any(vss, vss_test))]
449460
fn derive_vss_xprv(
450461
&self, config: &Arc<Config>, seed_bytes: &[u8; 64], logger: &Arc<FilesystemLogger>,
451462
) -> Result<Xpriv, BuildError> {
@@ -618,9 +629,14 @@ impl ArcedNodeBuilder {
618629
self.inner.read().unwrap().build_with_fs_store().map(Arc::new)
619630
}
620631

621-
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
632+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
622633
/// previously configured. Uses LnurlAuth as default method for authentication/authorization.
623-
#[cfg(any(vss, vss_test))]
634+
///
635+
/// **Caution**: [VSS] support is in **alpha**. Using [VSS] (or any remote persistence) may
636+
/// cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved
637+
/// after internal retries are exhausted.
638+
///
639+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
624640
pub fn build_with_vss_store(
625641
&self, vss_url: String, store_id: String, lnurl_auth_server_url: String,
626642
fixed_headers: HashMap<String, String>,
@@ -632,9 +648,14 @@ impl ArcedNodeBuilder {
632648
.map(Arc::new)
633649
}
634650

635-
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
651+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
636652
/// previously configured. Uses only FixedHeaders as default method for authentication/authorization.
637-
#[cfg(any(vss, vss_test))]
653+
///
654+
/// **Caution**: [VSS] support is in **alpha**. Using [VSS] (or any remote persistence) may
655+
/// cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved
656+
/// after internal retries are exhausted.
657+
///
658+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
638659
pub fn build_with_vss_store_with_fixed_headers(
639660
&self, vss_url: String, store_id: String, fixed_headers: HashMap<String, String>,
640661
) -> Result<Arc<Node>, BuildError> {
@@ -645,10 +666,15 @@ impl ArcedNodeBuilder {
645666
.map(Arc::new)
646667
}
647668

648-
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
669+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
649670
/// previously configured. Give `header_provider` is used to attach headers to every request made
650671
/// to [VSS](https://github.com/lightningdevkit/vss-server/blob/main/README.md) backend.
651-
#[cfg(any(vss, vss_test))]
672+
///
673+
/// **Caution**: [VSS] support is in **alpha**. Using [VSS] (or any remote persistence) may
674+
/// cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved
675+
/// after internal retries are exhausted.
676+
///
677+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
652678
pub fn build_with_vss_store_and_header_provider(
653679
&self, vss_url: String, store_id: String, header_provider: Arc<dyn VssHeaderProvider>,
654680
) -> Result<Arc<Node>, BuildError> {

src/io/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub mod sqlite_store;
1111
#[cfg(test)]
1212
pub(crate) mod test_utils;
1313
pub(crate) mod utils;
14-
#[cfg(any(vss, vss_test))]
1514
pub(crate) mod vss_store;
1615

1716
/// The event queue will be persisted under this key.

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ pub use io::utils::generate_entropy_mnemonic;
111111

112112
#[cfg(feature = "uniffi")]
113113
use uniffi_types::*;
114+
#[cfg(feature = "uniffi")]
115+
use vss_client::headers::{VssHeaderProvider, VssHeaderProviderError};
114116

115117
#[cfg(feature = "uniffi")]
116118
pub use builder::ArcedNodeBuilder as Builder;

0 commit comments

Comments
 (0)