Remote TypeByte()

This commit is contained in:
Jae Kwon
2015-04-14 15:57:16 -07:00
parent 37ddf3d09e
commit e5d34befde
12 changed files with 148 additions and 266 deletions
+1 -4
View File
@@ -8,7 +8,6 @@ import (
// PrivKey is part of PrivAccount and state.PrivValidator.
type PrivKey interface {
TypeByte() byte
Sign(msg []byte) Signature
PubKey() PubKey
}
@@ -21,7 +20,7 @@ const (
// for binary.readReflect
var _ = binary.RegisterInterface(
struct{ PrivKey }{},
binary.ConcreteType{PrivKeyEd25519{}},
binary.ConcreteType{PrivKeyEd25519{}, PrivKeyTypeEd25519},
)
//-------------------------------------
@@ -29,8 +28,6 @@ var _ = binary.RegisterInterface(
// Implements PrivKey
type PrivKeyEd25519 []byte
func (privKey PrivKeyEd25519) TypeByte() byte { return PrivKeyTypeEd25519 }
func (privKey PrivKeyEd25519) Sign(msg []byte) Signature {
pubKey := privKey.PubKey().(PubKeyEd25519)
privKeyBytes := new([64]byte)
+1 -4
View File
@@ -9,7 +9,6 @@ import (
// PubKey is part of Account and Validator.
type PubKey interface {
TypeByte() byte
IsNil() bool
Address() []byte
VerifyBytes(msg []byte, sig Signature) bool
@@ -23,7 +22,7 @@ const (
// for binary.readReflect
var _ = binary.RegisterInterface(
struct{ PubKey }{},
binary.ConcreteType{PubKeyEd25519{}},
binary.ConcreteType{PubKeyEd25519{}, PubKeyTypeEd25519},
)
//-------------------------------------
@@ -31,8 +30,6 @@ var _ = binary.RegisterInterface(
// Implements PubKey
type PubKeyEd25519 []byte
func (pubKey PubKeyEd25519) TypeByte() byte { return PubKeyTypeEd25519 }
func (pubKey PubKeyEd25519) IsNil() bool { return false }
// TODO: Or should this just be BinaryRipemd160(key)? (The difference is the TypeByte.)
+1 -4
View File
@@ -9,7 +9,6 @@ import (
// Signature is a part of Txs and consensus Votes.
type Signature interface {
TypeByte() byte
}
// Types of Signature implementations
@@ -20,7 +19,7 @@ const (
// for binary.readReflect
var _ = binary.RegisterInterface(
struct{ Signature }{},
binary.ConcreteType{SignatureEd25519{}},
binary.ConcreteType{SignatureEd25519{}, SignatureTypeEd25519},
)
//-------------------------------------
@@ -28,8 +27,6 @@ var _ = binary.RegisterInterface(
// Implements Signature
type SignatureEd25519 []byte
func (sig SignatureEd25519) TypeByte() byte { return SignatureTypeEd25519 }
func (sig SignatureEd25519) IsNil() bool { return false }
func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 }