diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-03-20 17:29:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 17:29:22 +0800 |
commit | c852eda00f781abafaab2b41d2c1a85fe9d3177f (patch) | |
tree | 931680bf76590c4bdb74c247582f213c17db9274 /core/test/state.go | |
parent | 448935829700500ecf512b9e0a6437cbb63504b3 (diff) | |
download | dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.tar dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.tar.gz dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.tar.bz2 dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.tar.lz dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.tar.xz dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.tar.zst dexon-consensus-c852eda00f781abafaab2b41d2c1a85fe9d3177f.zip |
core: reset DKG (#502)
* Allow utils.NodeSetCache to purge by rounds.
* Purge utils.NodeSetCache when DKG reset.
* Add a utils.RoundEvent handler to abort all
previous running DKG
* Fix test.App hangs in BlockDelivered when
utils.RoundEvent is attached.
ValidateNextRound is a blocking call and would
block test.App.BlockDelivered.
Diffstat (limited to 'core/test/state.go')
-rw-r--r-- | core/test/state.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/core/test/state.go b/core/test/state.go index 89d2e90..ce906ae 100644 --- a/core/test/state.go +++ b/core/test/state.go @@ -77,9 +77,6 @@ var ( // ErrChangeWontApply means the state change won't be applied for some // reason. ErrChangeWontApply = errors.New("change won't apply") - // ErrUnmatchedResetCount means an DKG message attempt to apply is not - // the latest reset count in State module. - ErrUnmatchedResetCount = errors.New("unmatched reset count of DKG message") // ErrNotInRemoteMode means callers attempts to call functions for remote // mode when the State instance is still in local mode. ErrNotInRemoteMode = errors.New( @@ -641,17 +638,17 @@ func (s *State) isValidRequest(req *StateChangeRequest) error { case StateAddDKGMPKReady: ready := req.Payload.(*typesDKG.MPKReady) if ready.Reset != s.dkgResetCount[ready.Round] { - return ErrUnmatchedResetCount + return ErrChangeWontApply } case StateAddDKGFinal: final := req.Payload.(*typesDKG.Finalize) if final.Reset != s.dkgResetCount[final.Round] { - return ErrUnmatchedResetCount + return ErrChangeWontApply } case StateAddDKGMasterPublicKey: mpk := req.Payload.(*typesDKG.MasterPublicKey) if mpk.Reset != s.dkgResetCount[mpk.Round] { - return ErrUnmatchedResetCount + return ErrChangeWontApply } // If we've received identical MPK, ignore it. mpkForRound, exists := s.dkgMasterPublicKeys[mpk.Round] @@ -671,7 +668,7 @@ func (s *State) isValidRequest(req *StateChangeRequest) error { case StateAddDKGComplaint: comp := req.Payload.(*typesDKG.Complaint) if comp.Reset != s.dkgResetCount[comp.Round] { - return ErrUnmatchedResetCount + return ErrChangeWontApply } // If we've received DKG final from that proposer, we would ignore // its complaint. |