mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Add block ban flag --invalid-block-roots (#7042)
This commit is contained in:
@@ -2773,3 +2773,43 @@ fn beacon_node_backend_override() {
|
||||
assert_eq!(config.store.backend, BeaconNodeBackend::LevelDb);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_block_roots_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, 0x3db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f358")
|
||||
.expect("Unable to write to file");
|
||||
CommandLineTest::new()
|
||||
.flag(
|
||||
"invalid-block-roots",
|
||||
dir.path().join("invalid-block-roots").as_os_str().to_str(),
|
||||
)
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| assert_eq!(config.chain.invalid_block_roots.len(), 3))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_block_roots_default_holesky() {
|
||||
use beacon_node::beacon_chain::chain_config::INVALID_HOLESKY_BLOCK_ROOT;
|
||||
CommandLineTest::new()
|
||||
.flag("network", Some("holesky"))
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert_eq!(config.chain.invalid_block_roots.len(), 1);
|
||||
assert!(config
|
||||
.chain
|
||||
.invalid_block_roots
|
||||
.contains(&*INVALID_HOLESKY_BLOCK_ROOT));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_block_roots_default_mainnet() {
|
||||
CommandLineTest::new()
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert!(config.chain.invalid_block_roots.is_empty());
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user