Skip to content

Commit

Permalink
Stop using ClientOptions in ClientContext directly
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-ds committed Oct 22, 2024
1 parent 6793ce4 commit f727975
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions linera-client/src/client_context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::{collections::BTreeMap, sync::Arc};
use std::{
collections::{BTreeMap, HashSet},
sync::Arc,
};

use async_trait::async_trait;
use futures::Future;
Expand All @@ -14,7 +17,7 @@ use linera_base::{
};
use linera_chain::data_types::Certificate;
use linera_core::{
client::{ChainClient, Client, MessagePolicy},
client::{BlanketMessagePolicy, ChainClient, Client, MessagePolicy},
data_types::ClientOutcome,
join_set_ext::{JoinSet, JoinSetExt as _},
node::CrossChainMessageDelivery,
Expand Down Expand Up @@ -43,10 +46,7 @@ use {
simple::SimpleMassClient, RpcMessage,
},
linera_sdk::abis::fungible,
std::{
collections::{HashMap, HashSet},
iter,
},
std::{collections::HashMap, iter},
tracing::{error, trace},
};
#[cfg(feature = "fs")]
Expand Down Expand Up @@ -82,8 +82,9 @@ where
pub recv_timeout: Duration,
pub retry_delay: Duration,
pub max_retries: u32,
pub options: ClientOptions,
pub chain_listeners: JoinSet,
pub blanket_message_policy: BlanketMessagePolicy,
pub restrict_chain_ids_to: Option<HashSet<ChainId>>,
}

#[cfg_attr(not(web), async_trait)]
Expand Down Expand Up @@ -177,8 +178,9 @@ where
recv_timeout: options.recv_timeout,
retry_delay: options.retry_delay,
max_retries: options.max_retries,
options,
chain_listeners: JoinSet::default(),
blanket_message_policy: options.blanket_message_policy,
restrict_chain_ids_to: options.restrict_chain_ids_to,
}
}

Expand Down Expand Up @@ -217,8 +219,8 @@ where
chain.pending_blobs.clone(),
);
chain_client.options_mut().message_policy = MessagePolicy::new(
self.options.blanket_message_policy,
self.options.restrict_chain_ids_to.clone(),
self.blanket_message_policy,
self.restrict_chain_ids_to.clone(),
);
Ok(chain_client)
}
Expand Down

0 comments on commit f727975

Please sign in to comment.