Skip to content

Commit f64288b

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 ad6f3a7 commit f64288b

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
@@ -181,12 +181,14 @@ impl Builder {
181181
let entropy_source_config = self.entropy_source_config.read().unwrap();
182182
let chain_data_source_config = self.chain_data_source_config.read().unwrap();
183183
let gossip_source_config = self.gossip_source_config.read().unwrap();
184+
let runtime = Arc::new(RwLock::new(None));
184185
Arc::new(build_with_store_internal(
185186
config,
186187
entropy_source_config.as_ref(),
187188
chain_data_source_config.as_ref(),
188189
gossip_source_config.as_ref(),
189190
kv_store,
191+
runtime,
190192
))
191193
}
192194
}
@@ -196,6 +198,7 @@ fn build_with_store_internal<'a, K: KVStore + Sync + Send + 'static>(
196198
config: Arc<Config>, entropy_source_config: Option<&'a EntropySourceConfig>,
197199
chain_data_source_config: Option<&'a ChainDataSourceConfig>,
198200
gossip_source_config: Option<&'a GossipSourceConfig>, kv_store: Arc<K>,
201+
runtime: Arc<RwLock<Option<tokio::runtime::Runtime>>>,
199202
) -> Node<K> {
200203
let ldk_data_dir = format!("{}/ldk", config.storage_dir_path);
201204
fs::create_dir_all(ldk_data_dir.clone()).expect("Failed to create LDK data directory");
@@ -265,7 +268,6 @@ fn build_with_store_internal<'a, K: KVStore + Sync + Send + 'static>(
265268
}
266269
};
267270

268-
let runtime = Arc::new(RwLock::new(None));
269271
let wallet =
270272
Arc::new(Wallet::new(blockchain, bdk_wallet, Arc::clone(&runtime), Arc::clone(&logger)));
271273

0 commit comments

Comments
 (0)