diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-02-27 11:03:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 11:03:18 +0800 |
commit | 9e18a2b406b58e4b44eea4d5741f71f689f8022c (patch) | |
tree | 5d57be5631f350c833cd9bef3b83d47c404f068d /core/syncer/agreement.go | |
parent | fc8aae4eb1608ce574f853a1b1ecd60014886882 (diff) | |
download | dexon-consensus-9e18a2b406b58e4b44eea4d5741f71f689f8022c.tar.gz dexon-consensus-9e18a2b406b58e4b44eea4d5741f71f689f8022c.tar.zst dexon-consensus-9e18a2b406b58e4b44eea4d5741f71f689f8022c.zip |
syncer: fix syncer panic (#456)
* Fix syncer panic
We can't verify correctness for randomness result from rounds that
corresponding configurations are not ready yet.
* Fix blocks are not confirmed while they should be
Diffstat (limited to 'core/syncer/agreement.go')
-rw-r--r-- | core/syncer/agreement.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/syncer/agreement.go b/core/syncer/agreement.go index acc4f1c..9f1abca 100644 --- a/core/syncer/agreement.go +++ b/core/syncer/agreement.go @@ -160,8 +160,10 @@ func (a *agreement) processNewCRS(round uint64) { if round <= a.latestCRSRound { return } + prevRound := a.latestCRSRound + 1 + a.latestCRSRound = round // Verify all pending results. - for r := a.latestCRSRound + 1; r <= round; r++ { + for r := prevRound; r <= a.latestCRSRound; r++ { pendingsForRound := a.pendings[r] if pendingsForRound == nil { continue @@ -169,7 +171,9 @@ func (a *agreement) processNewCRS(round uint64) { delete(a.pendings, r) for _, res := range pendingsForRound { if err := core.VerifyAgreementResult(res, a.cache); err != nil { - a.logger.Error("invalid agreement result", "result", res) + a.logger.Error("invalid agreement result", + "result", res, + "error", err) continue } a.logger.Error("flush agreement result", "result", res) @@ -177,7 +181,6 @@ func (a *agreement) processNewCRS(round uint64) { break } } - a.latestCRSRound = round } // confirm notifies consensus the confirmation of a block in BA. |