diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/syncer/watch-cat.go | 7 | ||||
-rw-r--r-- | core/syncer/watch-cat_test.go | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/core/syncer/watch-cat.go b/core/syncer/watch-cat.go index ba385bc..5f06499 100644 --- a/core/syncer/watch-cat.go +++ b/core/syncer/watch-cat.go @@ -106,9 +106,8 @@ func (wc *WatchCat) Start() { }() defer wc.cancel() proposed := false - threshold := uint64( - utils.GetConfigWithPanic(wc.configReader, lastPos.Round, wc.logger). - NotarySetSize / 2) + threshold := uint64(utils.GetDKGThreshold( + utils.GetConfigWithPanic(wc.configReader, lastPos.Round, wc.logger))) wc.logger.Info("Threshold for recovery", "votes", threshold) ResetLoop: for { @@ -124,7 +123,7 @@ func (wc *WatchCat) Start() { votes, err := wc.recovery.Votes(lastPos.Height) if err != nil { wc.logger.Error("Failed to get recovery votes", "height", lastPos.Height, "error", err) - } else if votes > threshold { + } else if votes >= threshold { wc.logger.Info("Threshold for recovery reached!") wc.lastPosition = lastPos break ResetLoop diff --git a/core/syncer/watch-cat_test.go b/core/syncer/watch-cat_test.go index 8bb6d7b..1ceb620 100644 --- a/core/syncer/watch-cat_test.go +++ b/core/syncer/watch-cat_test.go @@ -107,7 +107,7 @@ func (s *WatchCatTestSuite) TestBasicUsage() { } rec.lock.Lock() - rec.votes[pos.Height] = uint64(notarySet/2 + 1) + rec.votes[pos.Height] = uint64((notarySet * 2 / 3) + 1) rec.lock.Unlock() time.Sleep(polling * 2) |