sc-finality-grandpa: Warp proof generation can not expect justifications (#13249)

When a node is running with `--blocks-pruning` it will also prunes justifications. So, the warp
proof generation can not use `expect` for unwrapping the justification.
This commit is contained in:
Bastian Köcher
2023-01-28 20:10:40 +01:00
committed by GitHub
parent 175072d572
commit 1aaea41155
2 changed files with 2 additions and 5 deletions
@@ -49,6 +49,7 @@ pub struct PruningParams {
/// [default: 256]
#[arg(alias = "pruning", long, value_name = "PRUNING_MODE")]
pub state_pruning: Option<DatabasePruningMode>,
/// Specify the blocks pruning mode.
///
/// This mode specifies when the block's body (including justifications)
@@ -135,11 +135,7 @@ impl<Block: BlockT> WarpSyncProof<Block> {
let justification = blockchain
.justifications(header.hash())?
.and_then(|just| just.into_justification(GRANDPA_ENGINE_ID))
.expect(
"header is last in set and contains standard change signal; \
must have justification; \
qed.",
);
.ok_or_else(|| Error::MissingData)?;
let justification = GrandpaJustification::<Block>::decode(&mut &justification[..])?;