aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/utils
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-01-04 23:59:17 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commitf2865a49b3a18f7d02886a831a14d99033bf43ae (patch)
treed6f3d8fab446222fe3d5f4d3bea557a9f279ee30 /vendor/github.com/dexon-foundation/dexon-consensus/core/utils
parent30950e88c8c96b583b34da0a8ec1e2b44b4e1b0b (diff)
downloadgo-tangerine-f2865a49b3a18f7d02886a831a14d99033bf43ae.tar.gz
go-tangerine-f2865a49b3a18f7d02886a831a14d99033bf43ae.tar.zst
go-tangerine-f2865a49b3a18f7d02886a831a14d99033bf43ae.zip
vendor: sync to latest core (#129)
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/utils')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go5
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go2
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go16
3 files changed, 4 insertions, 19 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go
index 60424115e..43bbde13d 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go
@@ -90,7 +90,8 @@ func VerifyBlockSignature(b *types.Block) (err error) {
}
-func hashVote(vote *types.Vote) common.Hash {
+// HashVote generates hash of a types.Vote.
+func HashVote(vote *types.Vote) common.Hash {
binaryPeriod := make([]byte, 8)
binary.LittleEndian.PutUint64(binaryPeriod, vote.Period)
@@ -108,7 +109,7 @@ func hashVote(vote *types.Vote) common.Hash {
// VerifyVoteSignature verifies the signature of types.Vote.
func VerifyVoteSignature(vote *types.Vote) (bool, error) {
- hash := hashVote(vote)
+ hash := HashVote(vote)
pubKey, err := crypto.SigToPub(hash, vote.Signature)
if err != nil {
return false, err
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go
index 47bea3f3d..7694dab4e 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go
@@ -66,7 +66,7 @@ func (s *Signer) SignBlock(b *types.Block) (err error) {
// SignVote signs a types.Vote.
func (s *Signer) SignVote(v *types.Vote) (err error) {
v.ProposerID = s.proposerID
- v.Signature, err = s.prvKey.Sign(hashVote(v))
+ v.Signature, err = s.prvKey.Sign(HashVote(v))
return
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go
index 687d0ea22..8c9f77a69 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go
@@ -15,22 +15,6 @@
// along with the dexon-consensus library. If not, see
// <http://www.gnu.org/licenses/>.
-// This file is part of the dexon-consensus library.
-//
-// The dexon-consensus library is free software: you can redistribute it
-// and/or modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation, either version 3 of the License,
-// or (at your option) any later version.
-//
-// The dexon-consensus library is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
-// General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the dexon-consensus library. If not, see
-// <http://www.gnu.org/licenses/>.
-
package utils
import (