Skip to content

Commit d12726a

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 88e4c91 commit d12726a

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
@@ -163,12 +163,14 @@ impl Builder {
163163
let entropy_source_config = self.entropy_source_config.read().unwrap();
164164
let chain_data_source_config = self.chain_data_source_config.read().unwrap();
165165
let gossip_source_config = self.gossip_source_config.read().unwrap();
166+
let runtime = Arc::new(RwLock::new(None));
166167
Arc::new(build_with_store_internal(
167168
config,
168169
entropy_source_config.as_ref(),
169170
chain_data_source_config.as_ref(),
170171
gossip_source_config.as_ref(),
171172
kv_store,
173+
runtime,
172174
))
173175
}
174176
}
@@ -178,6 +180,7 @@ fn build_with_store_internal<'a, K: KVStore + Sync + Send + 'static>(
178180
config: Arc<Config>, entropy_source_config: Option<&'a EntropySourceConfig>,
179181
chain_data_source_config: Option<&'a ChainDataSourceConfig>,
180182
gossip_source_config: Option<&'a GossipSourceConfig>, kv_store: Arc<K>,
183+
runtime: Arc<RwLock<Option<tokio::runtime::Runtime>>>,
181184
) -> Node<K> {
182185
let ldk_data_dir = format!("{}/ldk", config.storage_dir_path);
183186
fs::create_dir_all(ldk_data_dir.clone()).expect("Failed to create LDK data directory");
@@ -247,7 +250,6 @@ fn build_with_store_internal<'a, K: KVStore + Sync + Send + 'static>(
247250
}
248251
};
249252

250-
let runtime = Arc::new(RwLock::new(None));
251253
let wallet =
252254
Arc::new(Wallet::new(blockchain, bdk_wallet, Arc::clone(&runtime), Arc::clone(&logger)));
253255

0 commit comments

Comments
 (0)