From 75627b5e26bcb2de6f5f8ef7ea1537091c5424ea Mon Sep 17 00:00:00 2001 From: noot <36753753+noot@users.noreply.github.com> Date: Thu, 4 Nov 2021 13:56:24 -0400 Subject: [PATCH] fix(lib/grandpa): use `defaultGrandpaInterval` if not set, fixes error on startup (#1982) --- lib/grandpa/errors.go | 3 --- lib/grandpa/grandpa.go | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/grandpa/errors.go b/lib/grandpa/errors.go index 505b6e8556..1c0eb36f42 100644 --- a/lib/grandpa/errors.go +++ b/lib/grandpa/errors.go @@ -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") diff --git a/lib/grandpa/grandpa.go b/lib/grandpa/grandpa.go index cb4122e9f2..43e3d5af6e 100644 --- a/lib/grandpa/grandpa.go +++ b/lib/grandpa/grandpa.go @@ -38,6 +38,7 @@ import ( const ( finalityGrandpaRoundMetrics = "gossamer/finality/grandpa/round" + defaultGrandpaInterval = time.Second ) var ( @@ -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())