diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-12-22 12:54:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-22 12:54:03 +0800 |
commit | 6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6 (patch) | |
tree | 1895248f011a356fcd2a28c03dbda9d93fd46fd8 /core/utils.go | |
parent | 146ed32cf841151b826eafd7d6ade188c56865bf (diff) | |
download | tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.tar tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.tar.gz tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.tar.bz2 tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.tar.lz tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.tar.xz tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.tar.zst tangerine-consensus-6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6.zip |
utils: move authenticator to utils package (#378)
Diffstat (limited to 'core/utils.go')
-rw-r--r-- | core/utils.go | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/core/utils.go b/core/utils.go index 671d680..838369c 100644 --- a/core/utils.go +++ b/core/utils.go @@ -146,27 +146,6 @@ func HashConfigurationBlock( ) } -// VerifyBlock verifies the signature of types.Block. -func VerifyBlock(b *types.Block) (err error) { - hash, err := hashBlock(b) - if err != nil { - return - } - if hash != b.Hash { - err = ErrIncorrectHash - return - } - pubKey, err := crypto.SigToPub(b.Hash, b.Signature) - if err != nil { - return - } - if !b.ProposerID.Equal(types.NewNodeID(pubKey)) { - err = ErrIncorrectSignature - return - } - return -} - // VerifyAgreementResult perform sanity check against a types.AgreementResult // instance. func VerifyAgreementResult( @@ -201,7 +180,7 @@ func VerifyAgreementResult( if _, exist := notarySet[vote.ProposerID]; !exist { return ErrIncorrectVoteProposer } - ok, err := verifyVoteSignature(&vote) + ok, err := utils.VerifyVoteSignature(&vote) if err != nil { return err } |