Skip to content

Commit cd85df1

Browse files
committed
Let build_with_store_internal take a runtime parameter
This is required to allow the VSS `KVStore` to share a reference to the runtime. The runtime option will be set `Some` by `Node::start`.
1 parent baa2ead commit cd85df1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/builder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,14 @@ impl Builder {
199199
let entropy_source_config = self.entropy_source_config.read().unwrap();
200200
let chain_data_source_config = self.chain_data_source_config.read().unwrap();
201201
let gossip_source_config = self.gossip_source_config.read().unwrap();
202+
let runtime = Arc::new(RwLock::new(None));
202203
Arc::new(build_with_store_internal(
203204
config,
204205
entropy_source_config.as_ref(),
205206
chain_data_source_config.as_ref(),
206207
gossip_source_config.as_ref(),
207208
kv_store,
209+
runtime,
208210
))
209211
}
210212
}
@@ -214,6 +216,7 @@ fn build_with_store_internal<'a, K: KVStore + Sync + Send + 'static>(
214216
config: Arc<Config>, entropy_source_config: Option<&'a EntropySourceConfig>,
215217
chain_data_source_config: Option<&'a ChainDataSourceConfig>,
216218
gossip_source_config: Option<&'a GossipSourceConfig>, kv_store: Arc<K>,
219+
runtime: Arc<RwLock<Option<tokio::runtime::Runtime>>>,
217220
) -> Node<K> {
218221
let ldk_data_dir = format!("{}/ldk", config.storage_dir_path);
219222
fs::create_dir_all(ldk_data_dir.clone()).expect("Failed to create LDK data directory");
@@ -287,7 +290,6 @@ fn build_with_store_internal<'a, K: KVStore + Sync + Send + 'static>(
287290
}
288291
};
289292

290-
let runtime = Arc::new(RwLock::new(None));
291293
let wallet =
292294
Arc::new(Wallet::new(blockchain, bdk_wallet, Arc::clone(&runtime), Arc::clone(&logger)));
293295

0 commit comments

Comments
 (0)