diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-11-27 09:55:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-27 09:55:13 +0800 |
commit | 60c1b59a97379753889b693460ada18b45d2beea (patch) | |
tree | c2238c8eeb27237e3199274b6d32fac03bac3f72 /core/agreement-mgr.go | |
parent | 6d95559bf7eb62e6c114ca4d4040c44ffd553629 (diff) | |
download | dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.tar dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.tar.gz dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.tar.bz2 dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.tar.lz dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.tar.xz dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.tar.zst dexon-consensus-60c1b59a97379753889b693460ada18b45d2beea.zip |
core: Fix stuffs (#342)
Diffstat (limited to 'core/agreement-mgr.go')
-rw-r--r-- | core/agreement-mgr.go | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/core/agreement-mgr.go b/core/agreement-mgr.go index 10469de..f695e36 100644 --- a/core/agreement-mgr.go +++ b/core/agreement-mgr.go @@ -1,18 +1,18 @@ -// Copyright 2018 The dexon-consensus-core Authors -// This file is part of the dexon-consensus-core library. +// Copyright 2018 The dexon-consensus Authors +// This file is part of the dexon-consensus library. // -// The dexon-consensus-core library is free software: you can redistribute it +// The dexon-consensus library is free software: you can redistribute it // and/or modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation, either version 3 of the License, // or (at your option) any later version. // -// The dexon-consensus-core library is distributed in the hope that it will be +// The dexon-consensus library is distributed in the hope that it will be // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser // General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the dexon-consensus-core library. If not, see +// along with the dexon-consensus library. If not, see // <http://www.gnu.org/licenses/>. package core @@ -382,15 +382,29 @@ Loop: // This round is finished. break Loop } - nextHeight, err := mgr.lattice.NextHeight(recv.round, setting.chainID) - if err != nil { - panic(err) + oldPos := agr.agreementID() + var nextHeight uint64 + for { + nextHeight, err = mgr.lattice.NextHeight(recv.round, setting.chainID) + if err != nil { + panic(err) + } + if isStop(oldPos) || nextHeight == 0 { + break + } + if nextHeight > oldPos.Height { + break + } + time.Sleep(100 * time.Millisecond) + mgr.logger.Debug("Lattice not ready!!!", + "old", &oldPos, "next", nextHeight) } - agr.restart(setting.notarySet, types.Position{ + nextPos := types.Position{ Round: recv.round, ChainID: setting.chainID, Height: nextHeight, - }, setting.crs) + } + agr.restart(setting.notarySet, nextPos, setting.crs) default: } if agr.pullVotes() { |