malus: dont panic on missing validation data (#6952)

* malus: don't panic if can't fetch validation data

* malus: add fast-runtime feature
This commit is contained in:
ordian
2023-04-26 16:03:26 +02:00
committed by GitHub
parent d8723a080c
commit 703009fb39
2 changed files with 9 additions and 3 deletions
+1
View File
@@ -37,6 +37,7 @@ rand = "0.8.5"
[features] [features]
default = [] default = []
fast-runtime = ["polkadot-cli/fast-runtime"]
[dev-dependencies] [dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
@@ -122,17 +122,22 @@ where
{ {
Ok(Some((validation_data, validation_code))) => { Ok(Some((validation_data, validation_code))) => {
sender sender
.send((validation_data, validation_code, n_validators)) .send(Some((
validation_data,
validation_code,
n_validators,
)))
.expect("channel is still open"); .expect("channel is still open");
}, },
_ => { _ => {
panic!("Unable to fetch validation data"); sender.send(None).expect("channel is still open");
}, },
} }
}), }),
); );
let (validation_data, validation_code, n_validators) = receiver.recv().unwrap(); let (validation_data, validation_code, n_validators) =
receiver.recv().unwrap()?;
let validation_data_hash = validation_data.hash(); let validation_data_hash = validation_data.hash();
let validation_code_hash = validation_code.hash(); let validation_code_hash = validation_code.hash();