| 31 | use alloy_transport_ipc::IpcConnect; |
| 32 | use std::future::Future; |
| 33 | |
| 34 | /// The number of times the engine client will try to reconnect |
| 35 | /// after failing to connect to the IPC socket. |
| 36 | const IPC_CONNECT_MAX_RETRIES: u32 = 200; |
| 37 | |
| 38 | /// Typed error returned by `EngineClient` methods so callers can decide |
| 39 | /// whether to retry, drop a round, or shut down — instead of the wrapper |
| 40 | /// panicking on every non-transport JSON-RPC failure. |
| 41 | /// |
| 42 | /// Transport-level retry already happens inside each engine-client method |
| 43 | /// via `wait_until_reconnect_available`, so by the time an |
| 44 | /// `EngineClientError` reaches a caller the call has already been retried |
| 45 | /// once after reconnect (or the error is JSON-RPC level, which is not |
| 46 | /// retryable). Callers typically treat any `Err` as a graceful shutdown |
| 47 | /// signal. |
| 48 | #[derive(Debug)] |
| 49 | pub struct EngineClientError(pub TransportError); |
| 50 | |
| 51 | impl EngineClientError { |
| 52 | /// Construct a custom, non-retryable engine-client error from a message. |
| 53 | /// Primarily for tests that simulate an execution-client failure (e.g. a |
| 54 | /// failed forkchoice commit at an epoch boundary). |
| 55 | pub fn custom(msg: &str) -> Self { |
| 56 | EngineClientError(TransportErrorKind::custom_str(msg)) |
| 57 | } |
| 58 | } |
nothing calls this directly
no outgoing calls
no test coverage detected