diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index fc2df55e9f..37e000b263 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -918,18 +918,20 @@ pub fn get_config( .map_err(|e| format!("Failed to read invalid-block-roots file {}", e))?; let invalid_block_roots: HashSet = contents .split(',') - .filter_map(|s| match Hash256::from_str(s.trim()) { - Ok(block_root) => Some(block_root), - Err(e) => { - warn!( - log, - "Unable to parse invalid block root"; - "block_root" => s, - "error" => ?e, - ); - None - } - }) + .filter_map( + |s| match Hash256::from_str(s.strip_prefix("0x").unwrap_or(s).trim()) { + Ok(block_root) => Some(block_root), + Err(e) => { + warn!( + log, + "Unable to parse invalid block root"; + "block_root" => s, + "error" => ?e, + ); + None + } + }, + ) .collect(); client_config.chain.invalid_block_roots = invalid_block_roots; } diff --git a/lighthouse/tests/beacon_node.rs b/lighthouse/tests/beacon_node.rs index 13e93746dc..8c5c296797 100644 --- a/lighthouse/tests/beacon_node.rs +++ b/lighthouse/tests/beacon_node.rs @@ -2765,7 +2765,7 @@ fn invalid_block_root_flag() { let dir = TempDir::new().expect("Unable to create temporary directory"); let mut file = File::create(dir.path().join("invalid-block-roots")).expect("Unable to create file"); - file.write_all(b"2db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f359, 2db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f358") + file.write_all(b"2db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f359, 2db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f358, 0x2db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f359") .expect("Unable to write to file"); CommandLineTest::new() .flag(