Skip to content

Commit

Permalink
grandpa: handle error from SelectChain::finality_target
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva committed Jul 26, 2024
1 parent 326342f commit b1447b9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions substrate/client/consensus/grandpa/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,14 +1214,20 @@ where
.header(target_hash)?
.expect("Header known to exist after `finality_target` call; qed"),
Err(err) => {
warn!(
debug!(
target: LOG_TARGET,
"Encountered error finding best chain containing {:?}: couldn't find target block: {}",
block,
err,
);

return Ok(None)
// NOTE: in case the given `SelectChain` doesn't provide any block we fallback to using
// the given base block provided by the GRANDPA voter.
//
// For example, `LongestChain` will error if the given block to use as base isn't part
// of the best chain (as defined by `LongestChain`), which could happen if there was a
// re-org.
base_header.clone()
},
};

Expand Down

0 comments on commit b1447b9

Please sign in to comment.