Skip to content

Commit

Permalink
with arc
Browse files Browse the repository at this point in the history
  • Loading branch information
G8XSU authored and tnull committed Feb 7, 2024
1 parent ca05de4 commit a83b58e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ impl NodeBuilder {
/// previously configured.
#[cfg(any(vss, vss_test))]
pub fn build_with_vss_store(
&self, url: String, store_id: String, auth_custom: impl AuthMethod + 'static,
&self, url: String, store_id: String, auth_custom: Arc<dyn AuthMethod>,
) -> Result<Node, BuildError> {
let logger = setup_logger(&self.config)?;

Expand All @@ -321,7 +321,7 @@ impl NodeBuilder {

let vss_seed_bytes: [u8; 32] = vss_xprv.private_key.secret_bytes();

let vss_store = Arc::new(VssStore::new(url, store_id, vss_seed_bytes, auth_custom));
let vss_store = Arc::new(VssStore::new(url, store_id, vss_seed_bytes, auth_custom.clone()));
build_with_store_internal(
config,
self.chain_data_source_config.as_ref(),
Expand Down Expand Up @@ -462,7 +462,7 @@ impl ArcedNodeBuilder {
/// previously configured.
#[cfg(any(vss, vss_test))]
pub fn build_with_vss_store(
&self, url: String, store_id: String, auth_custom: impl AuthMethod + 'static,
&self, url: String, store_id: String, auth_custom: Arc<dyn AuthMethod>,
) -> Result<Arc<Node>, BuildError> {
self.inner.read().unwrap().build_with_vss_store(url, store_id).map(Arc::new)
}
Expand Down
4 changes: 2 additions & 2 deletions src/io/vss_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct VssStore {
impl VssStore {
pub(crate) fn new(
base_url: String, store_id: String, data_encryption_key: [u8; 32],
auth_custom: impl AuthMethod + 'static,
auth_custom: Arc<dyn AuthMethod>,
) -> Self {
let runtime = tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap();
let storable_builder = StorableBuilder::new(data_encryption_key, RandEntropySource);
Expand All @@ -60,7 +60,7 @@ impl VssStore {
}) as _);

let client = VssClient::new(&base_url, retry_policy);
Self { client, store_id, runtime, storable_builder, auth_custom: Arc::new(auth_custom) }
Self { client, store_id, runtime, storable_builder, auth_custom }
}

fn build_key(
Expand Down

0 comments on commit a83b58e

Please sign in to comment.