Skip to content

Commit 1c51a36

Browse files
committed
Use a default store_id in default build_with_vss_store
There's not really any reason to force devs to select a `store_id` in the default `build_with_vss_store` anymore - we use a key derived from the node entropy to key the storage on the service side which should prevent anything else from accessing the same data unless its very deliberate. Thus, we simply drop the `store_id` parameter to `build_with_vss_store`.
1 parent 88c6151 commit 1c51a36

File tree

2 files changed

+9
-36
lines changed

2 files changed

+9
-36
lines changed

src/builder.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ impl NodeBuilder {
571571
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
572572
/// previously configured.
573573
///
574-
/// Uses a simple authentication scheme proving knowledge of a secret key.
574+
/// Uses a simple authentication scheme proving knowledge of a secret key and a `store_id` of
575+
/// "ldk-node".
575576
///
576577
/// `fixed_headers` are included as it is in all the requests made to VSS and LNURL auth server.
577578
///
@@ -581,10 +582,10 @@ impl NodeBuilder {
581582
///
582583
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
583584
pub fn build_with_vss_store(
584-
&self, node_entropy: NodeEntropy, vss_url: String, store_id: String,
585-
fixed_headers: HashMap<String, String>,
585+
&self, node_entropy: NodeEntropy, vss_url: String, fixed_headers: HashMap<String, String>,
586586
) -> Result<Node, BuildError> {
587587
let logger = setup_logger(&self.log_writer_config, &self.config)?;
588+
let store_id = "ldk-node".to_owned();
588589
let builder = VssStoreBuilder::new(node_entropy, vss_url, store_id, self.config.network);
589590
let vss_store = builder.build_with_sigs_auth(fixed_headers).map_err(|e| {
590591
log_error!(logger, "Failed to setup VSS store: {}", e);

tests/integration_tests_vss.rs

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ async fn channel_full_cycle_with_vss_store() {
2525
builder_a.set_chain_source_esplora(esplora_url.clone(), None);
2626
let vss_base_url = std::env::var("TEST_VSS_BASE_URL").unwrap();
2727
let node_a = builder_a
28-
.build_with_vss_store(
29-
config_a.node_entropy,
30-
vss_base_url.clone(),
31-
"".to_owned(),
32-
HashMap::new(),
33-
)
28+
.build_with_vss_store(config_a.node_entropy, vss_base_url.clone(), HashMap::new())
3429
.unwrap();
3530
node_a.start().unwrap();
3631

@@ -39,12 +34,7 @@ async fn channel_full_cycle_with_vss_store() {
3934
let mut builder_b = Builder::from_config(config_b.node_config);
4035
builder_b.set_chain_source_esplora(esplora_url.clone(), None);
4136
let node_b = builder_b
42-
.build_with_vss_store(
43-
config_b.node_entropy,
44-
vss_base_url,
45-
"".to_owned(),
46-
HashMap::new(),
47-
)
37+
.build_with_vss_store(config_b.node_entropy, vss_base_url, HashMap::new())
4838
.unwrap();
4939
node_b.start().unwrap();
5040

@@ -79,11 +69,7 @@ async fn vss_v0_schema_backwards_compatibility() {
7969
builder_old.set_entropy_seed_bytes(seed_bytes);
8070
builder_old.set_chain_source_esplora(esplora_url.clone(), None);
8171
let node_old = builder_old
82-
.build_with_vss_store(
83-
vss_base_url.clone(),
84-
"".to_owned(),
85-
HashMap::new(),
86-
)
72+
.build_with_vss_store(node_entropy, vss_base_url.clone(), HashMap::new())
8773
.unwrap();
8874

8975
node_old.start().unwrap();
@@ -120,8 +106,6 @@ async fn vss_v0_schema_backwards_compatibility() {
120106
.build_with_vss_store(
121107
node_entropy,
122108
vss_base_url,
123-
"".to_owned(),
124-
HashMap::new(),
125109
)
126110
.unwrap();
127111

@@ -155,12 +139,7 @@ async fn vss_node_restart() {
155139
builder.set_storage_dir_path(storage_path.clone());
156140
builder.set_chain_source_esplora(esplora_url.clone(), None);
157141
let node = builder
158-
.build_with_vss_store(
159-
node_entropy,
160-
vss_base_url.clone(),
161-
"".to_owned(),
162-
HashMap::new(),
163-
)
142+
.build_with_vss_store(node_entropy, vss_base_url.clone(), HashMap::new())
164143
.unwrap();
165144

166145
node.start().unwrap();
@@ -188,14 +167,7 @@ async fn vss_node_restart() {
188167
builder.set_storage_dir_path(storage_path);
189168
builder.set_chain_source_esplora(esplora_url, None);
190169

191-
let node = builder
192-
.build_with_vss_store(
193-
node_entropy,
194-
vss_base_url,
195-
"".to_owned(),
196-
HashMap::new(),
197-
)
198-
.unwrap();
170+
let node = builder.build_with_vss_store(node_entropy, vss_base_url, HashMap::new()).unwrap();
199171

200172
node.start().unwrap();
201173
node.sync_wallets().unwrap();

0 commit comments

Comments
 (0)