make submitVote private

pull/3419/head
Rongjian Lan 4 years ago
parent ff9a85ac48
commit d3eeb15ce7
  1. 4
      consensus/construct_test.go
  2. 2
      consensus/quorum/one-node-one-vote.go
  3. 2
      consensus/quorum/one-node-staked-vote.go
  4. 14
      consensus/quorum/quorom_test.go
  5. 2
      consensus/quorum/quorum.go

@ -73,7 +73,7 @@ func TestConstructPreparedMessage(test *testing.T) {
leaderKey.FromLibBLSPublicKey(leaderPubKey) leaderKey.FromLibBLSPublicKey(leaderPubKey)
validatorKey := bls.SerializedPublicKey{} validatorKey := bls.SerializedPublicKey{}
validatorKey.FromLibBLSPublicKey(validatorPubKey) validatorKey.FromLibBLSPublicKey(validatorPubKey)
consensus.Decider.SubmitVote( consensus.Decider.submitVote(
quorum.Prepare, quorum.Prepare,
[]bls.SerializedPublicKey{leaderKey}, []bls.SerializedPublicKey{leaderKey},
leaderPriKey.Sign(message), leaderPriKey.Sign(message),
@ -81,7 +81,7 @@ func TestConstructPreparedMessage(test *testing.T) {
consensus.blockNum, consensus.blockNum,
consensus.GetCurBlockViewID(), consensus.GetCurBlockViewID(),
) )
if _, err := consensus.Decider.SubmitVote( if _, err := consensus.Decider.submitVote(
quorum.Prepare, quorum.Prepare,
[]bls.SerializedPublicKey{validatorKey}, []bls.SerializedPublicKey{validatorKey},
validatorPriKey.Sign(message), validatorPriKey.Sign(message),

@ -36,7 +36,7 @@ func (v *uniformVoteWeight) AddNewVote(
for i, pubKey := range pubKeys { for i, pubKey := range pubKeys {
pubKeysBytes[i] = pubKey.Bytes pubKeysBytes[i] = pubKey.Bytes
} }
return v.SubmitVote(p, pubKeysBytes, sig, headerHash, height, viewID) return v.submitVote(p, pubKeysBytes, sig, headerHash, height, viewID)
} }
// IsQuorumAchieved .. // IsQuorumAchieved ..

@ -82,7 +82,7 @@ func (v *stakedVoteWeight) AddNewVote(
pubKeysBytes[i] = pubKey.Bytes pubKeysBytes[i] = pubKey.Bytes
} }
ballet, err := v.SubmitVote(p, pubKeysBytes, sig, headerHash, height, viewID) ballet, err := v.submitVote(p, pubKeysBytes, sig, headerHash, height, viewID)
if err != nil { if err != nil {
return ballet, err return ballet, err

@ -88,7 +88,7 @@ func TestSubmitVote(test *testing.T) {
decider.UpdateParticipants([]bls.PublicKeyWrapper{pubKeyWrapper1, pubKeyWrapper2}) decider.UpdateParticipants([]bls.PublicKeyWrapper{pubKeyWrapper1, pubKeyWrapper2})
if _, err := decider.SubmitVote( if _, err := decider.submitVote(
Prepare, Prepare,
[]bls.SerializedPublicKey{pubKeyWrapper1.Bytes}, []bls.SerializedPublicKey{pubKeyWrapper1.Bytes},
blsPriKey1.Sign(message), blsPriKey1.Sign(message),
@ -99,7 +99,7 @@ func TestSubmitVote(test *testing.T) {
test.Log(err) test.Log(err)
} }
if _, err := decider.SubmitVote( if _, err := decider.submitVote(
Prepare, Prepare,
[]bls.SerializedPublicKey{pubKeyWrapper2.Bytes}, []bls.SerializedPublicKey{pubKeyWrapper2.Bytes},
blsPriKey2.Sign(message), blsPriKey2.Sign(message),
@ -110,7 +110,7 @@ func TestSubmitVote(test *testing.T) {
test.Log(err) test.Log(err)
} }
if decider.SignersCount(Prepare) != 2 { if decider.SignersCount(Prepare) != 2 {
test.Fatal("SubmitVote failed") test.Fatal("submitVote failed")
} }
aggSig := &bls_core.Sign{} aggSig := &bls_core.Sign{}
@ -145,7 +145,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) {
decider.UpdateParticipants([]bls.PublicKeyWrapper{pubKeyWrapper1, pubKeyWrapper2}) decider.UpdateParticipants([]bls.PublicKeyWrapper{pubKeyWrapper1, pubKeyWrapper2})
decider.SubmitVote( decider.submitVote(
Prepare, Prepare,
[]bls.SerializedPublicKey{pubKeyWrapper1.Bytes}, []bls.SerializedPublicKey{pubKeyWrapper1.Bytes},
blsPriKey1.SignHash(blockHash[:]), blsPriKey1.SignHash(blockHash[:]),
@ -160,7 +160,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) {
aggSig.Add(s) aggSig.Add(s)
} }
} }
if _, err := decider.SubmitVote( if _, err := decider.submitVote(
Prepare, Prepare,
[]bls.SerializedPublicKey{pubKeyWrapper2.Bytes, pubKeyWrapper3.Bytes}, []bls.SerializedPublicKey{pubKeyWrapper2.Bytes, pubKeyWrapper3.Bytes},
aggSig, aggSig,
@ -172,7 +172,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) {
} }
if decider.SignersCount(Prepare) != 3 { if decider.SignersCount(Prepare) != 3 {
test.Fatal("SubmitVote failed") test.Fatal("submitVote failed")
} }
aggSig.Add(blsPriKey1.SignHash(blockHash[:])) aggSig.Add(blsPriKey1.SignHash(blockHash[:]))
@ -180,7 +180,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) {
test.Fatal("AggregateVotes failed") test.Fatal("AggregateVotes failed")
} }
if _, err := decider.SubmitVote( if _, err := decider.submitVote(
Prepare, Prepare,
[]bls.SerializedPublicKey{pubKeyWrapper2.Bytes}, []bls.SerializedPublicKey{pubKeyWrapper2.Bytes},
aggSig, aggSig,

@ -81,7 +81,7 @@ type ParticipantTracker interface {
// SignatoryTracker .. // SignatoryTracker ..
type SignatoryTracker interface { type SignatoryTracker interface {
ParticipantTracker ParticipantTracker
SubmitVote( submitVote(
p Phase, pubkeys []bls.SerializedPublicKey, p Phase, pubkeys []bls.SerializedPublicKey,
sig *bls_core.Sign, headerHash common.Hash, sig *bls_core.Sign, headerHash common.Hash,
height, viewID uint64, height, viewID uint64,

Loading…
Cancel
Save