diff --git a/src/eth/rpc/rpc_server.rs b/src/eth/rpc/rpc_server.rs index daafe5378..585d1eaa9 100644 --- a/src/eth/rpc/rpc_server.rs +++ b/src/eth/rpc/rpc_server.rs @@ -240,11 +240,20 @@ async fn stratus_startup(_: Params<'_>, _: Arc, _: Extensions) -> an async fn stratus_readiness(_: Params<'_>, context: Arc, _: Extensions) -> anyhow::Result { let should_serve = context.consensus.should_serve().await; tracing::info!("stratus_readiness: {}", should_serve); - Ok(json!(should_serve)) + + if should_serve { + Ok(json!(true)) + } else { + Err(RpcError::Response(rpc_internal_error("Service Not Ready".to_string()))) + } } async fn stratus_liveness(_: Params<'_>, _: Arc, _: Extensions) -> anyhow::Result { - Ok(json!(true)) + if !GlobalState::is_shutdown() { + Ok(json!(true)) + } else { + Err(RpcError::Response(rpc_internal_error("Service Unhealthy".to_string()))) + } } // -----------------------------------------------------------------------------