execrpc: an empty or unparsable reply is no answer, so a stopped node reads as silent to the watchdog's probe
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
291ea5418f
commit
073fbea1d1
1 changed files with 3 additions and 1 deletions
|
|
@ -40,7 +40,9 @@ fn post(evm_port: u16, method: &str, params: Value, timeout: Duration) -> Result
|
|||
);
|
||||
let _ = std::fs::remove_file(&tmp);
|
||||
let out = out.ok_or_else(|| format!("{method}: the node's RPC did not answer"))?;
|
||||
let v: Value = serde_json::from_str(&out).map_err(|e| format!("{method}: {e}"))?;
|
||||
// an empty or unparsable body is no answer (a stopped node's socket still accepts the connection and curl
|
||||
// returns nothing inside its own limit; the probe must read that as silence, 7 October 2026)
|
||||
let v: Value = serde_json::from_str(&out).map_err(|e| format!("{method}: the node's RPC did not answer ({e})"))?;
|
||||
if let Some(err) = v.get("error") {
|
||||
return Err(format!("{method}: {}", err.get("message").and_then(|m| m.as_str()).unwrap_or("error")));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue