Skip to content

Commit

Permalink
Fix apply only forced changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimartiro committed Dec 9, 2024
1 parent dfbac1f commit 248bfab
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions dot/sync/block_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,24 @@ func (b *blockImporter) checkAndApplyForcedAuthChanges(blockData types.BlockData

for i := range consensusDigests {
digest := consensusDigests[i]
switch digest.ConsensusEngineID {
case types.GrandpaEngineID:
if digest.ConsensusEngineID == types.GrandpaEngineID {
data := types.NewGrandpaConsensusDigest()
err := scale.Unmarshal(digest.Data, &data)
if err != nil {
return fmt.Errorf("unmarshaling grandpa consensus digest: %w", err)
}

err = b.grandpaState.HandleGRANDPADigest(header, data)
digestValue, err := data.Value()
if err != nil {
return fmt.Errorf("handling grandpa digest: %w", err)
return fmt.Errorf("getting digest value: %w", err)
}

if _, ok := digestValue.(types.GrandpaForcedChange); ok {
err = b.grandpaState.HandleGRANDPADigest(header, data)
if err != nil {
return fmt.Errorf("handling grandpa digest: %w", err)
}
}
default:
// Will be handle by the block importer
continue
}
}

Expand Down

0 comments on commit 248bfab

Please sign in to comment.