diff --git a/server/src/scanner_ws_parse.rs b/server/src/scanner_ws_parse.rs index c6c8bd17..56597a5b 100644 --- a/server/src/scanner_ws_parse.rs +++ b/server/src/scanner_ws_parse.rs @@ -30,12 +30,12 @@ pub fn parse_ws_frame(text: &str) -> Vec { }; if let Some(block) = value.get("block") { - if let Some(hash) = block.get("id").and_then(|v| v.as_str()) { - if let Ok(h) = BlockHash::from_str(hash) { - return vec![h]; - } - } - return Vec::new(); + return block + .get("id") + .and_then(|v| v.as_str()) + .and_then(|s| BlockHash::from_str(s).ok()) + .map(|h| vec![h]) + .unwrap_or_default(); } if let Some(blocks) = value.get("blocks").and_then(|v| v.as_array()) {