diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-08-13 14:02:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-13 14:02:23 +0800 |
commit | 39e2ea5eb982007a7438198f6d633fe580a3fd1f (patch) | |
tree | cd87fe44352df53d04ebfab71daf62ce57d46d28 /crypto | |
parent | ef8eef3e341777adc00b87c2b226bffbe337ebf6 (diff) | |
download | dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.tar dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.tar.gz dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.tar.bz2 dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.tar.lz dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.tar.xz dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.tar.zst dexon-consensus-39e2ea5eb982007a7438198f6d633fe580a3fd1f.zip |
core: ValidatorID.Hash is the hash of public key. (#49)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/eth/eth.go | 5 | ||||
-rw-r--r-- | crypto/interfaces.go | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/crypto/eth/eth.go b/crypto/eth/eth.go index edf50d3..975d8a8 100644 --- a/crypto/eth/eth.go +++ b/crypto/eth/eth.go @@ -104,6 +104,11 @@ func (pub PublicKey) Compress() []byte { return pub.publicKey } +// Bytes returns the []byte representation of public key. +func (pub PublicKey) Bytes() []byte { + return pub.Compress() +} + // SigToPub returns the PublicKey that created the given signature. func SigToPub( hash common.Hash, signature crypto.Signature) (PublicKey, error) { diff --git a/crypto/interfaces.go b/crypto/interfaces.go index 015ff40..280082e 100644 --- a/crypto/interfaces.go +++ b/crypto/interfaces.go @@ -39,4 +39,7 @@ type PrivateKey interface { type PublicKey interface { // VerifySignature checks that the given public key created signature over hash. VerifySignature(hash common.Hash, signature Signature) bool + + // Bytes returns the []byte representation of public key. + Bytes() []byte } |