fixed-length arrays cleanup

This commit is contained in:
Jae Kwon
2015-07-18 17:19:47 -07:00
parent dc7b912881
commit 8d1e176180
6 changed files with 39 additions and 52 deletions
-12
View File
@@ -2,7 +2,6 @@ package account
import (
"bytes"
"errors"
"github.com/tendermint/tendermint/Godeps/_workspace/src/github.com/tendermint/ed25519"
"github.com/tendermint/tendermint/Godeps/_workspace/src/github.com/tendermint/ed25519/extra25519"
@@ -12,7 +11,6 @@ import (
// PubKey is part of Account and Validator.
type PubKey interface {
IsNil() bool
Address() []byte
VerifyBytes(msg []byte, sig Signature) bool
}
@@ -33,8 +31,6 @@ var _ = binary.RegisterInterface(
// Implements PubKey
type PubKeyEd25519 [32]byte
func (pubKey PubKeyEd25519) IsNil() bool { return false }
// TODO: Or should this just be BinaryRipemd160(key)? (The difference is the TypeByte.)
func (pubKey PubKeyEd25519) Address() []byte { return binary.BinaryRipemd160(pubKey[:]) }
@@ -60,14 +56,6 @@ func (pubKey PubKeyEd25519) ToCurve25519() *[32]byte {
return keyCurve25519
}
// redundant: compiler does it for us
func (pubKey PubKeyEd25519) ValidateBasic() error {
if len(pubKey) != ed25519.PublicKeySize {
return errors.New("Invalid PubKeyEd25519 key size")
}
return nil
}
func (pubKey PubKeyEd25519) String() string {
return Fmt("PubKeyEd25519{%X}", pubKey[:])
}
-2
View File
@@ -27,8 +27,6 @@ var _ = binary.RegisterInterface(
// Implements Signature
type SignatureEd25519 [64]byte
func (sig SignatureEd25519) IsNil() bool { return false }
func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 }
func (sig SignatureEd25519) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) }