diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-09 12:21:27 +0800 |
---|---|---|
committer | Wei-Ning Huang <aitjcize@gmail.com> | 2018-10-09 12:21:27 +0800 |
commit | 86e15da7cee5463e37b972683b6b2fcf151a4a77 (patch) | |
tree | efa2b041f48de50b0b911851038eeda8563332e2 | |
parent | db07d005e2e5a9208620a8d0e5fcaedeaa6ed644 (diff) | |
download | tangerine-consensus-86e15da7cee5463e37b972683b6b2fcf151a4a77.tar.gz tangerine-consensus-86e15da7cee5463e37b972683b6b2fcf151a4a77.tar.zst tangerine-consensus-86e15da7cee5463e37b972683b6b2fcf151a4a77.zip |
Fix typo in crypto (#186)
-rw-r--r-- | core/crypto.go | 4 | ||||
-rw-r--r-- | core/crypto_test.go | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/core/crypto.go b/core/crypto.go index e286d2b..62c095d 100644 --- a/core/crypto.go +++ b/core/crypto.go @@ -256,8 +256,8 @@ func hashDKGFinalize(final *types.DKGFinalize) common.Hash { // VerifyDKGFinalizeSignature verifies DKGFinalize signature. func VerifyDKGFinalizeSignature( - final *types.DKGPartialSignature) (bool, error) { - hash := hashDKGPartialSignature(final) + final *types.DKGFinalize) (bool, error) { + hash := hashDKGFinalize(final) pubKey, err := crypto.SigToPub(hash, final.Signature) if err != nil { return false, err diff --git a/core/crypto_test.go b/core/crypto_test.go index 8cd2e20..bbedeaf 100644 --- a/core/crypto_test.go +++ b/core/crypto_test.go @@ -249,6 +249,20 @@ func (s *CryptoTestSuite) TestDKGSignature() { ok, err = verifyDKGPartialSignatureSignature(sig) s.Require().NoError(err) s.False(ok) + + final := &types.DKGFinalize{ + ProposerID: nID, + Round: 5, + } + final.Signature, err = prv.Sign(hashDKGFinalize(final)) + s.Require().NoError(err) + ok, err = VerifyDKGFinalizeSignature(final) + s.Require().NoError(err) + s.True(ok) + final.Round++ + ok, err = VerifyDKGFinalizeSignature(final) + s.Require().NoError(err) + s.False(ok) } func TestCrypto(t *testing.T) { |