Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(en): run MainNodeFeeParamsFetcher in API component #1988

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ async fn run_core(
task_handles: &mut Vec<JoinHandle<anyhow::Result<()>>>,
app_health: &AppHealthCheck,
stop_receiver: watch::Receiver<bool>,
fee_params_fetcher: Arc<MainNodeFeeParamsFetcher>,
singleton_pool_builder: &ConnectionPoolBuilder<Core>,
) -> anyhow::Result<SyncState> {
// Create components.
Expand Down Expand Up @@ -312,8 +311,6 @@ async fn run_core(
}

let sk_handle = task::spawn(state_keeper.run());
let fee_params_fetcher_handle =
tokio::spawn(fee_params_fetcher.clone().run(stop_receiver.clone()));
let remote_diamond_proxy_addr = config.remote.diamond_proxy_addr;
let diamond_proxy_addr = if let Some(addr) = config.optional.contracts_diamond_proxy_addr {
anyhow::ensure!(
Expand Down Expand Up @@ -378,7 +375,6 @@ async fn run_core(

task_handles.extend([
sk_handle,
fee_params_fetcher_handle,
consistency_checker_handle,
commitment_generator_handle,
updater_handle,
Expand Down Expand Up @@ -433,6 +429,10 @@ async fn run_api(
stop_receiver.clone(),
)));

let fee_params_fetcher_handle =
tokio::spawn(fee_params_fetcher.clone().run(stop_receiver.clone()));
task_handles.push(fee_params_fetcher_handle);

let tx_sender_builder =
TxSenderBuilder::new(config.into(), connection_pool.clone(), Arc::new(tx_proxy));

Expand Down Expand Up @@ -633,8 +633,6 @@ async fn init_tasks(
task_handles.push(tokio::spawn(fetcher.run(stop_receiver.clone())));
}

let fee_params_fetcher = Arc::new(MainNodeFeeParamsFetcher::new(main_node_client.clone()));

let sync_state = if components.contains(&Component::Core) {
run_core(
config,
Expand All @@ -644,7 +642,6 @@ async fn init_tasks(
task_handles,
app_health,
stop_receiver.clone(),
fee_params_fetcher.clone(),
&singleton_pool_builder,
)
.await?
Expand All @@ -661,6 +658,7 @@ async fn init_tasks(
};

if components.contains(&Component::HttpApi) || components.contains(&Component::WsApi) {
let fee_params_fetcher = Arc::new(MainNodeFeeParamsFetcher::new(main_node_client.clone()));
run_api(
task_handles,
config,
Expand Down
Loading