Errorf -> fmt.Errorf

This commit is contained in:
Jae Kwon
2015-04-15 21:49:14 -07:00
parent 58bcad3ea3
commit df1d46d04d
7 changed files with 20 additions and 25 deletions

View File

@ -33,7 +33,7 @@ type POL struct {
func (pol *POL) Verify(valSet *sm.ValidatorSet) error {
if uint(len(pol.Votes)) != valSet.Size() {
return Errorf("Invalid POL votes count: Expected %v, got %v",
return fmt.Errorf("Invalid POL votes count: Expected %v, got %v",
valSet.Size(), len(pol.Votes))
}
@ -61,16 +61,16 @@ func (pol *POL) Verify(valSet *sm.ValidatorSet) error {
BlockParts: pol.BlockParts,
})
} else if vote.Round > pol.Round {
return Errorf("Invalid commit round %v for POL %v", vote.Round, pol)
return fmt.Errorf("Invalid commit round %v for POL %v", vote.Round, pol)
}
// Validate
if _, seen := seenValidators[string(val.Address)]; seen {
return Errorf("Duplicate validator for vote %v for POL %v", vote, pol)
return fmt.Errorf("Duplicate validator for vote %v for POL %v", vote, pol)
}
if !val.PubKey.VerifyBytes(voteDoc, vote.Signature) {
return Errorf("Invalid signature for vote %v for POL %v", vote, pol)
return fmt.Errorf("Invalid signature for vote %v for POL %v", vote, pol)
}
// Tally
@ -81,7 +81,7 @@ func (pol *POL) Verify(valSet *sm.ValidatorSet) error {
if talliedVotingPower > valSet.TotalVotingPower()*2/3 {
return nil
} else {
return Errorf("Invalid POL, insufficient voting power %v, needed %v",
return fmt.Errorf("Invalid POL, insufficient voting power %v, needed %v",
talliedVotingPower, (valSet.TotalVotingPower()*2/3 + 1))
}