diff --git a/standalone/prb/src/worker.rs b/standalone/prb/src/worker.rs index 19bb2926f..1ba344b96 100644 --- a/standalone/prb/src/worker.rs +++ b/standalone/prb/src/worker.rs @@ -539,26 +539,19 @@ impl WorkerContext { vec![Value::from_bytes(worker_binding.as_ref().unwrap())], ); let stake_onchain: Option = fetch_storage_bytes(&api, &stake_query).await?; - match stake_onchain { - Some(onchain_stake) => { - info!( - "Stake: {:?}, {:?} on-chain", - &worker.stake.parse::().unwrap(), - &onchain_stake - ); - match onchain_stake { - onchain_stake if onchain_stake < worker.stake.parse::().unwrap() => { - set_worker_message!(c, "Adjusting on-chain stake..."); - txm.clone().restart_computing(pid, pubkey, worker.stake).await?; - Self::set_state(c.clone(), WorkerLifecycleState::Working).await; - } - onchain_stake if onchain_stake > worker.stake.parse::().unwrap() => { - set_worker_message!(c, "Error on-chain stake higher, than configured..."); - } - _ => (), - } + if let Some(onchain_stake) = stake_onchain { + info!("Stake: {:?}, {:?} on-chain", &worker.stake.parse::().unwrap(), &onchain_stake); + match onchain_stake { + onchain_stake if onchain_stake < worker.stake.parse::().unwrap() => { + set_worker_message!(c, "Adjusting on-chain stake..."); + txm.clone().restart_computing(pid, pubkey, worker.stake).await?; + Self::set_state(c.clone(), WorkerLifecycleState::Working).await; + } + onchain_stake if onchain_stake > worker.stake.parse::().unwrap() => { + set_worker_message!(c, "Error on-chain stake higher, than configured..."); + } + _ => (), } - None => (), } first_run = false; }