Skip to content

Commit

Permalink
fix(lib/grandpa): use defaultGrandpaInterval if not set, fixes erro…
Browse files Browse the repository at this point in the history
…r on startup (ChainSafe#1982)
  • Loading branch information
noot committed Nov 4, 2021
1 parent 383a5bc commit 75627b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions lib/grandpa/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ var (
// ErrAuthorityNotInSet is returned when a precommit within a justification is signed by a key not in the authority set
ErrAuthorityNotInSet = errors.New("authority is not in set")

// ErrZeroInterval is returned when the grandpa sub-round interval is set to 0
ErrZeroInterval = errors.New("cannot have zero second interval")

errVoteExists = errors.New("already have vote")
errVoteToSignatureMismatch = errors.New("votes and authority count mismatch")
errInvalidVoteBlock = errors.New("block in vote is not descendant of previously finalised block")
Expand Down
3 changes: 2 additions & 1 deletion lib/grandpa/grandpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (

const (
finalityGrandpaRoundMetrics = "gossamer/finality/grandpa/round"
defaultGrandpaInterval = time.Second
)

var (
Expand Down Expand Up @@ -147,7 +148,7 @@ func NewService(cfg *Config) (*Service, error) {
}

if cfg.Interval == 0 {
return nil, ErrZeroInterval
cfg.Interval = defaultGrandpaInterval
}

ctx, cancel := context.WithCancel(context.Background())
Expand Down

0 comments on commit 75627b5

Please sign in to comment.