Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lib/grandpa): use defaultGrandpaInterval if not set, fixes error on startup #1982

Merged
merged 2 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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