From d3eeb15ce79dc7f743d1cb35494b94cbe234eb23 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Fri, 30 Oct 2020 17:18:12 -0700 Subject: [PATCH] make submitVote private --- consensus/construct_test.go | 4 ++-- consensus/quorum/one-node-one-vote.go | 2 +- consensus/quorum/one-node-staked-vote.go | 2 +- consensus/quorum/quorom_test.go | 14 +++++++------- consensus/quorum/quorum.go | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/consensus/construct_test.go b/consensus/construct_test.go index 24b45c11a..a0111fb5d 100644 --- a/consensus/construct_test.go +++ b/consensus/construct_test.go @@ -73,7 +73,7 @@ func TestConstructPreparedMessage(test *testing.T) { leaderKey.FromLibBLSPublicKey(leaderPubKey) validatorKey := bls.SerializedPublicKey{} validatorKey.FromLibBLSPublicKey(validatorPubKey) - consensus.Decider.SubmitVote( + consensus.Decider.submitVote( quorum.Prepare, []bls.SerializedPublicKey{leaderKey}, leaderPriKey.Sign(message), @@ -81,7 +81,7 @@ func TestConstructPreparedMessage(test *testing.T) { consensus.blockNum, consensus.GetCurBlockViewID(), ) - if _, err := consensus.Decider.SubmitVote( + if _, err := consensus.Decider.submitVote( quorum.Prepare, []bls.SerializedPublicKey{validatorKey}, validatorPriKey.Sign(message), diff --git a/consensus/quorum/one-node-one-vote.go b/consensus/quorum/one-node-one-vote.go index 45db9bcd3..7455d6e72 100644 --- a/consensus/quorum/one-node-one-vote.go +++ b/consensus/quorum/one-node-one-vote.go @@ -36,7 +36,7 @@ func (v *uniformVoteWeight) AddNewVote( for i, pubKey := range pubKeys { pubKeysBytes[i] = pubKey.Bytes } - return v.SubmitVote(p, pubKeysBytes, sig, headerHash, height, viewID) + return v.submitVote(p, pubKeysBytes, sig, headerHash, height, viewID) } // IsQuorumAchieved .. diff --git a/consensus/quorum/one-node-staked-vote.go b/consensus/quorum/one-node-staked-vote.go index 8023b03d8..0f65257c9 100644 --- a/consensus/quorum/one-node-staked-vote.go +++ b/consensus/quorum/one-node-staked-vote.go @@ -82,7 +82,7 @@ func (v *stakedVoteWeight) AddNewVote( 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 { return ballet, err diff --git a/consensus/quorum/quorom_test.go b/consensus/quorum/quorom_test.go index d6b91a5bf..73767ea25 100644 --- a/consensus/quorum/quorom_test.go +++ b/consensus/quorum/quorom_test.go @@ -88,7 +88,7 @@ func TestSubmitVote(test *testing.T) { decider.UpdateParticipants([]bls.PublicKeyWrapper{pubKeyWrapper1, pubKeyWrapper2}) - if _, err := decider.SubmitVote( + if _, err := decider.submitVote( Prepare, []bls.SerializedPublicKey{pubKeyWrapper1.Bytes}, blsPriKey1.Sign(message), @@ -99,7 +99,7 @@ func TestSubmitVote(test *testing.T) { test.Log(err) } - if _, err := decider.SubmitVote( + if _, err := decider.submitVote( Prepare, []bls.SerializedPublicKey{pubKeyWrapper2.Bytes}, blsPriKey2.Sign(message), @@ -110,7 +110,7 @@ func TestSubmitVote(test *testing.T) { test.Log(err) } if decider.SignersCount(Prepare) != 2 { - test.Fatal("SubmitVote failed") + test.Fatal("submitVote failed") } aggSig := &bls_core.Sign{} @@ -145,7 +145,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) { decider.UpdateParticipants([]bls.PublicKeyWrapper{pubKeyWrapper1, pubKeyWrapper2}) - decider.SubmitVote( + decider.submitVote( Prepare, []bls.SerializedPublicKey{pubKeyWrapper1.Bytes}, blsPriKey1.SignHash(blockHash[:]), @@ -160,7 +160,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) { aggSig.Add(s) } } - if _, err := decider.SubmitVote( + if _, err := decider.submitVote( Prepare, []bls.SerializedPublicKey{pubKeyWrapper2.Bytes, pubKeyWrapper3.Bytes}, aggSig, @@ -172,7 +172,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) { } if decider.SignersCount(Prepare) != 3 { - test.Fatal("SubmitVote failed") + test.Fatal("submitVote failed") } aggSig.Add(blsPriKey1.SignHash(blockHash[:])) @@ -180,7 +180,7 @@ func TestSubmitVoteAggregateSig(test *testing.T) { test.Fatal("AggregateVotes failed") } - if _, err := decider.SubmitVote( + if _, err := decider.submitVote( Prepare, []bls.SerializedPublicKey{pubKeyWrapper2.Bytes}, aggSig, diff --git a/consensus/quorum/quorum.go b/consensus/quorum/quorum.go index f41d47ec1..ae82d7ef3 100644 --- a/consensus/quorum/quorum.go +++ b/consensus/quorum/quorum.go @@ -81,7 +81,7 @@ type ParticipantTracker interface { // SignatoryTracker .. type SignatoryTracker interface { ParticipantTracker - SubmitVote( + submitVote( p Phase, pubkeys []bls.SerializedPublicKey, sig *bls_core.Sign, headerHash common.Hash, height, viewID uint64,