diff --git a/dot/sync/block_importer.go b/dot/sync/block_importer.go index f00b9316d5..bbfa3d7853 100644 --- a/dot/sync/block_importer.go +++ b/dot/sync/block_importer.go @@ -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 } }