diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-03-22 20:20:52 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-22 20:20:52 +0800 |
commit | 0f2dd4260fd98b2be06b7f9b0197134c89f11d3c (patch) | |
tree | 49203e7f865fc823c0a51d88da27c3ff05656357 /core/utils/round-event.go | |
parent | 99723721b79e7f1cf5d1009d9117705d84df5eaa (diff) | |
download | tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.tar tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.tar.gz tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.tar.bz2 tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.tar.lz tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.tar.xz tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.tar.zst tangerine-consensus-0f2dd4260fd98b2be06b7f9b0197134c89f11d3c.zip |
core: abort hang DKG (#508)
* Capitalize log
* Fix DKG aborting hangs
Make sure reset cc.dkg to nil in runDKG
* Remember to purge tsig verfier too
* Replace abortCh with context.Context
* Fix obvious bug
* Fixup: forever blockin at Wait method when runDKG is not called
* Fixup: fix corner case
If the Add(1) moved to runDKG under cc.dkgLock,
we may not catch it after unlocking cc.dkgLock.
* fixup
Diffstat (limited to 'core/utils/round-event.go')
-rw-r--r-- | core/utils/round-event.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/utils/round-event.go b/core/utils/round-event.go index ff1d91e..7dace84 100644 --- a/core/utils/round-event.go +++ b/core/utils/round-event.go @@ -181,7 +181,7 @@ func NewRoundEvent(parentCtx context.Context, gov governanceAccessor, // block height. resetCount := gov.DKGResetCount(initRound + 1) remains := resetCount - for ; resetCount > 0 && !e.config.Contains(initBlockHeight); remains-- { + for ; remains > 0 && !e.config.Contains(initBlockHeight); remains-- { e.config.ExtendLength() } if !e.config.Contains(initBlockHeight) { @@ -272,7 +272,7 @@ func (e *RoundEvent) check(blockHeight, startRound uint64) ( } // A simple assertion to make sure we didn't pick the wrong round. if e.config.RoundID() != e.lastTriggeredRound { - panic(fmt.Errorf("triggered round not matched: %d, %d", + panic(fmt.Errorf("Triggered round not matched: %d, %d", e.config.RoundID(), e.lastTriggeredRound)) } param.Round = e.lastTriggeredRound @@ -280,7 +280,7 @@ func (e *RoundEvent) check(blockHeight, startRound uint64) ( param.BeginHeight = e.config.LastPeriodBeginHeight() param.CRS = GetCRSWithPanic(e.gov, e.lastTriggeredRound, e.logger) param.Config = GetConfigWithPanic(e.gov, e.lastTriggeredRound, e.logger) - e.logger.Info("new RoundEvent triggered", + e.logger.Info("New RoundEvent triggered", "round", e.lastTriggeredRound, "reset", e.lastTriggeredResetCount, "begin-height", e.config.LastPeriodBeginHeight(), @@ -322,7 +322,7 @@ func (e *RoundEvent) check(blockHeight, startRound uint64) ( e.gov.DKGComplaints(nextRound), GetDKGThreshold(nextCfg)); err != nil { e.logger.Debug( - "group public key setup failed, waiting for DKG reset", + "Group public key setup failed, waiting for DKG reset", "round", nextRound, "reset", e.lastTriggeredResetCount) e.dkgFailed = true |