diff --git a/internal/consensus/state.go b/internal/consensus/state.go index 3f6dfa8b5e..32810e5e55 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -2608,7 +2608,7 @@ func (cs *State) AddCommit(commit *types.Commit, peerID p2p.ID) (added bool, err return added, err } - if !types.IsAggregatedCommit(cs.Validators, commit) { + if !commit.HasAggregatedSignature() { // Only accept aggregated commits cs.Logger.Error("Received non aggregated commit for height %v from peer ID %s", commit.Height, peerID) return added, err diff --git a/types/validation.go b/types/validation.go index c7c6f4e90b..74ab332952 100644 --- a/types/validation.go +++ b/types/validation.go @@ -21,8 +21,8 @@ func shouldBatchVerify(vals *ValidatorSet, commit *Commit) bool { vals.AllKeysHaveSameType() } -// IsAggregatedCommit returns true if the commit is an aggregated. -func IsAggregatedCommit(vals *ValidatorSet, commit *Commit) bool { +// isAggregatedCommit returns true if the commit is an aggregated. +func isAggregatedCommit(vals *ValidatorSet, commit *Commit) bool { _, ok := vals.GetProposer().PubKey.(*bls12381.PubKey) _, ok2 := vals.GetProposer().PubKey.(bls12381.PubKey) return (ok || ok2) && vals.AllKeysHaveSameType() && commit.HasAggregatedSignature() @@ -51,7 +51,7 @@ func VerifyCommit(chainID string, vals *ValidatorSet, blockID BlockID, ignore := func(c CommitSig) bool { return c.BlockIDFlag == BlockIDFlagAbsent } // attempt to verify aggregated commit - if IsAggregatedCommit(vals, commit) { + if isAggregatedCommit(vals, commit) { // only count the signatures that are for the block count := func(c CommitSig) bool { return c.BlockIDFlag == BlockIDFlagAggCommit || c.BlockIDFlag == BlockIDFlagAggCommitAbsent @@ -129,7 +129,7 @@ func verifyCommitLightInternal( count := func(_ CommitSig) bool { return true } // attempt to verify aggregated commit - if IsAggregatedCommit(vals, commit) { + if isAggregatedCommit(vals, commit) { // ignore all commit signatures that are not for the block ignore := func(c CommitSig) bool { return !(c.BlockIDFlag == BlockIDFlagAggCommit || c.BlockIDFlag == BlockIDFlagAggCommitAbsent) @@ -220,7 +220,7 @@ func verifyCommitLightTrustingInternal( count := func(_ CommitSig) bool { return true } // attempt to verify aggregated commit - if IsAggregatedCommit(vals, commit) { + if isAggregatedCommit(vals, commit) { // ignore all commit signatures that are not for the block ignore := func(c CommitSig) bool { return !(c.BlockIDFlag == BlockIDFlagAggCommit || c.BlockIDFlag == BlockIDFlagAggCommitAbsent)