diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-29 15:17:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-29 15:17:13 +0800 |
commit | 92d1b675e7acff789a819426521efc99bdbd9aff (patch) | |
tree | e3c886a6678e7338d114ca9baec0ca2632b748ac /core/consensus_test.go | |
parent | 04a4df9479e31f1418760a389060706a72259381 (diff) | |
download | dexon-consensus-92d1b675e7acff789a819426521efc99bdbd9aff.tar.gz dexon-consensus-92d1b675e7acff789a819426521efc99bdbd9aff.tar.zst dexon-consensus-92d1b675e7acff789a819426521efc99bdbd9aff.zip |
core: run dkg by height (#527)
* core: run dkg by height
* core: check cc.dkgCtx before running each dkg phases
* fix
Diffstat (limited to 'core/consensus_test.go')
-rw-r--r-- | core/consensus_test.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/core/consensus_test.go b/core/consensus_test.go index 9565e95..19c43ad 100644 --- a/core/consensus_test.go +++ b/core/consensus_test.go @@ -267,7 +267,23 @@ func (s *ConsensusTestSuite) TestDKGCRS() { } time.Sleep(gov.Configuration(0).MinBlockInterval * 4) for _, con := range cons { - go con.runDKG(0, 0, gov.Configuration(0)) + go con.runDKG(0, 0, 0, 0) + } + crsFinish := make(chan struct{}, len(cons)) + for _, con := range cons { + go func(con *Consensus) { + height := uint64(0) + Loop: + for { + select { + case <-crsFinish: + break Loop + case <-time.After(lambda): + } + con.event.NotifyHeight(height) + height++ + } + }(con) } for _, con := range cons { func() { @@ -278,16 +294,12 @@ func (s *ConsensusTestSuite) TestDKGCRS() { } }() } - crsFinish := make(chan struct{}) for _, con := range cons { go func(con *Consensus) { con.runCRS(0, gov.CRS(0), false) crsFinish <- struct{}{} }(con) } - for range cons { - <-crsFinish - } s.NotNil(gov.CRS(1)) } |