diff options
-rw-r--r-- | core/agreement.go | 2 | ||||
-rw-r--r-- | core/configuration-chain_test.go | 3 | ||||
-rw-r--r-- | core/utils.go | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/core/agreement.go b/core/agreement.go index 1919830..16f36bc 100644 --- a/core/agreement.go +++ b/core/agreement.go @@ -174,7 +174,7 @@ func (a *agreement) restart( a.data.votes[1] = newVoteListMap() a.data.period = 2 a.data.blocks = make(map[types.NodeID]*types.Block) - a.data.requiredVote = len(notarySet)/3*2 + 1 + a.data.requiredVote = len(notarySet)*2/3 + 1 a.data.leader.restart(crs) a.data.lockValue = types.NullBlockHash a.data.lockIter = 0 diff --git a/core/configuration-chain_test.go b/core/configuration-chain_test.go index 7c73f41..af7e36d 100644 --- a/core/configuration-chain_test.go +++ b/core/configuration-chain_test.go @@ -279,6 +279,9 @@ func (s *ConfigurationChainTestSuite) TestConfigurationChain() { hash := crypto.Keccak256Hash([]byte("🌚🌝")) psigs := s.preparePartialSignature(hash, round, cfgChains) + // We only need k partial signatures. + psigs = psigs[:k] + tsigs := make([]crypto.Signature, 0, n) errs := make(chan error, n) tsigChan := make(chan crypto.Signature, n) diff --git a/core/utils.go b/core/utils.go index 5742d11..bd31701 100644 --- a/core/utils.go +++ b/core/utils.go @@ -163,7 +163,7 @@ func VerifyAgreementResult( if err != nil { return err } - if len(res.Votes) < len(notarySet)/3*2+1 { + if len(res.Votes) < len(notarySet)*2/3+1 { return ErrNotEnoughVotes } voted := make(map[types.NodeID]struct{}, len(notarySet)) |