Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 3287153

Browse files
authored
add check if pool is active (#287)
* add check if pool is active when orchestrator boots
1 parent 16b57a3 commit 3287153

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

orchestrator/src/main.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ use crate::node::status_update::NodeStatusUpdater;
1111
use crate::store::core::RedisStore;
1212
use crate::store::core::StoreContext;
1313
use crate::utils::loop_heartbeats::LoopHeartbeats;
14+
use alloy::primitives::U256;
1415
use anyhow::Result;
1516
use clap::Parser;
1617
use log::debug;
1718
use log::error;
19+
use log::info;
1820
use log::LevelFilter;
1921
use shared::web3::contracts::core::builder::ContractBuilder;
22+
use shared::web3::contracts::structs::compute_pool::PoolStatus;
2023
use shared::web3::wallet::Wallet;
2124
use std::sync::Arc;
2225
use tokio::task::JoinSet;
@@ -140,6 +143,22 @@ async fn main() -> Result<()> {
140143
.unwrap(),
141144
);
142145

146+
match contracts
147+
.compute_pool
148+
.get_pool_info(U256::from(compute_pool_id))
149+
.await
150+
{
151+
Ok(pool) if pool.status == PoolStatus::ACTIVE => Arc::new(pool),
152+
Ok(_) => {
153+
info!("Pool is not active. Exiting.");
154+
return Ok(());
155+
}
156+
Err(e) => {
157+
error!("Failed to get pool info: {}", e);
158+
return Ok(());
159+
}
160+
};
161+
143162
let discovery_store_context = store_context.clone();
144163
let discovery_heartbeats = heartbeats.clone();
145164
tasks.spawn(async move {

0 commit comments

Comments
 (0)