diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-08-30 10:45:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-30 10:45:06 +0800 |
commit | 2681e011bd48ec107dedae9c7dcbc0810673298c (patch) | |
tree | 11dbe2b7ff285d3fa57d983e1103ccb61bfe122c /core/crypto_test.go | |
parent | ca3b30a62ff85090c1a721602e8b202e6ae9a2bd (diff) | |
download | dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.tar dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.tar.gz dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.tar.bz2 dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.tar.lz dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.tar.xz dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.tar.zst dexon-consensus-2681e011bd48ec107dedae9c7dcbc0810673298c.zip |
core: Leader Selector. (#80)
Diffstat (limited to 'core/crypto_test.go')
-rw-r--r-- | core/crypto_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/crypto_test.go b/core/crypto_test.go index ccfcebb..62f7daa 100644 --- a/core/crypto_test.go +++ b/core/crypto_test.go @@ -209,6 +209,22 @@ func (s *CryptoTestSuite) TestVoteSignature() { s.False(verifyVoteSignature(vote, eth.SigToPub)) } +func (s *CryptoTestSuite) TestCRSSignature() { + crs := common.NewRandomHash() + prv, err := eth.NewPrivateKey() + s.Require().Nil(err) + pub := prv.PublicKey() + vID := types.NewValidatorID(pub) + block := &types.Block{ + ProposerID: vID, + } + block.CRSSignature, err = prv.Sign(hashCRS(block, crs)) + s.Require().Nil(err) + s.True(verifyCRSSignature(block, crs, eth.SigToPub)) + block.Height++ + s.False(verifyCRSSignature(block, crs, eth.SigToPub)) +} + func TestCrypto(t *testing.T) { suite.Run(t, new(CryptoTestSuite)) } |