diff --git a/dot/state/grandpa.go b/dot/state/grandpa.go index 777bcb204ca..d548b18cddc 100644 --- a/dot/state/grandpa.go +++ b/dot/state/grandpa.go @@ -92,7 +92,6 @@ func (s *GrandpaState) HandleGRANDPADigest(header *types.Header, digest scale.Va case types.GrandpaScheduledChange: return s.addScheduledChange(header, val) case types.GrandpaForcedChange: - fmt.Printf("adding a forced change\n") return s.addForcedChange(header, val) case types.GrandpaOnDisabled: return nil @@ -125,7 +124,6 @@ func (s *GrandpaState) addForcedChange(header *types.Header, fc types.GrandpaFor return fmt.Errorf("cannot import forced change: %w", err) } - fmt.Printf("there are now %d possible forced changes\n", s.forcedChanges.Len()) logger.Debugf("there are now %d possible forced changes", s.forcedChanges.Len()) return nil } @@ -259,13 +257,6 @@ func (s *GrandpaState) ApplyForcedChanges(importedBlockHeader *types.Header) err return fmt.Errorf("cannot set change set id at block") } - logger.Debug("reseting scheduled changes and forced changes") - s.scheduledChangeRoots.reset() - s.forcedChanges.reset() - - logger.Debugf("Applying authority set forced change on block #%d made at block #%d", - importedBlockHeader.Number, forcedChange.announcingHeader.Number) - return nil } diff --git a/dot/state/grandpa_changes.go b/dot/state/grandpa_changes.go index 425372f55e5..e06f1fe0faa 100644 --- a/dot/state/grandpa_changes.go +++ b/dot/state/grandpa_changes.go @@ -132,10 +132,6 @@ func (oc *orderedPendingChanges) pruneChanges(hash common.Hash, isDescendantOf i return nil } -func (oc *orderedPendingChanges) reset() { - *oc = make([]pendingChange, 0) -} - type pendingChangeNode struct { change *pendingChange nodes []*pendingChangeNode @@ -289,8 +285,7 @@ func (ct changeTree) findApplicableChange(hash common.Hash, number uint, } if child.change.announcingHeader.Number <= number && isDescendant { - return false, fmt.Errorf("%w: %s (%d)", errUnfinalizedAncestor, - child.change.announcingHeader.Hash(), child.change.announcingHeader.Number) + return false, errUnfinalizedAncestor } } @@ -319,7 +314,3 @@ func (ct *changeTree) pruneChanges(hash common.Hash, isDescendantOf isDescendant *ct = onBranchChanges return nil } - -func (ct *changeTree) reset() { - *ct = []*pendingChangeNode{} -}