Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: propagate error instead of panicking in manual sealing #2983

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,23 +1808,28 @@ where
.client
.header(hash)
.map_err(|e| sp_inherents::Error::Application(Box::new(e)))?
.expect("Best block header should be present")
.ok_or(sp_inherents::Error::Application(
"Best block header should be present".into(),
))?
.digest;
// Get the nimbus id from the digest.
let nimbus_id = digest
.logs
.iter()
.find_map(|x| {
if let DigestItem::PreRuntime(nimbus_primitives::NIMBUS_ENGINE_ID, nimbus_id) = x {
Some(
NimbusId::from_slice(nimbus_id.as_slice())
.expect("Nimbus pre-runtime digest should be valid"),
)
Some(NimbusId::from_slice(nimbus_id.as_slice()).map_err(|_| {
sp_inherents::Error::Application(
"Nimbus pre-runtime digest should be valid".into(),
)
}))
} else {
None
}
})
.expect("Nimbus pre-runtime digest should be present");
.ok_or(sp_inherents::Error::Application(
"Nimbus pre-runtime digest should be present".into(),
))??;
// Remove the old VRF digest.
let pos = digest.logs.iter().position(|x| {
matches!(
Expand Down
Loading