mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-27 18:34:39 +00:00
Remote TypeByte()
This commit is contained in:
+1
-4
@@ -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
@@ -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.)
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user