Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
malus: dont panic on missing validation data (#6952)
Browse files Browse the repository at this point in the history
* malus: don't panic if can't fetch validation data

* malus: add fast-runtime feature
  • Loading branch information
ordian authored Apr 26, 2023
1 parent 254c521 commit 64170f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions node/malus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ rand = "0.8.5"

[features]
default = []
fast-runtime = ["polkadot-cli/fast-runtime"]

[dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
Expand Down
11 changes: 8 additions & 3 deletions node/malus/src/variants/suggest_garbage_candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,22 @@ where
{
Ok(Some((validation_data, validation_code))) => {
sender
.send((validation_data, validation_code, n_validators))
.send(Some((
validation_data,
validation_code,
n_validators,
)))
.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_code_hash = validation_code.hash();
Expand Down

0 comments on commit 64170f4

Please sign in to comment.