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>
(cherry picked from commit 073fbea1d1)
This commit is contained in:
igneum-labs 2026-10-07 12:12:10 +00:00
parent 635e8576a8
commit ced26986fd

View file

@ -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")));
}