diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-08-16 10:22:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-16 10:22:54 +0800 |
commit | 96fcee4688dacd812292376994a3500e2c78edeb (patch) | |
tree | 2e15153e47b9d75bce11e35d47ad265466856afa /core/crypto_test.go | |
parent | d3107b56cbef1f05baddb64880c3e97d7eda87a4 (diff) | |
download | dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.tar dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.tar.gz dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.tar.bz2 dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.tar.lz dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.tar.xz dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.tar.zst dexon-consensus-96fcee4688dacd812292376994a3500e2c78edeb.zip |
core: Add compaction chain module. (#60)
Diffstat (limited to 'core/crypto_test.go')
-rw-r--r-- | core/crypto_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/crypto_test.go b/core/crypto_test.go index e59e66e..f5ec28e 100644 --- a/core/crypto_test.go +++ b/core/crypto_test.go @@ -64,7 +64,7 @@ func (s *CryptoTestSuite) prepareBlock(prevBlock *types.Block) *types.Block { }, } } - parentHash, err := hashCompactionChainAck(prevBlock) + parentHash, err := hashConsensusInfo(prevBlock) s.Require().Nil(err) s.Require().NotEqual(prevBlock.Hash, common.Hash{}) acks[parentHash] = struct{}{} @@ -102,10 +102,10 @@ func (s *CryptoTestSuite) generateCompactionChain( blocks[idx] = block var err error if idx > 0 { - block.ConsensusInfoParentHash, err = hashCompactionChainAck(blocks[idx-1]) + block.ConsensusInfoParentHash, err = hashConsensusInfo(blocks[idx-1]) s.Require().Nil(err) - block.CompactionChainAck.ConsensusSignature, err = - signCompactionChainAck(blocks[idx-1], prv) + block.CompactionChainAck.ConsensusInfoSignature, err = + signConsensusInfo(blocks[idx-1], prv) s.Require().Nil(err) } } @@ -128,11 +128,11 @@ func (s *CryptoTestSuite) TestCompactionChainAckSignature() { ackingBlock, exist := blockMap[block.CompactionChainAck.AckingBlockHash] s.Require().True(exist) s.True(ackingBlock.ConsensusInfo.Height == block.ConsensusInfo.Height-1) - hash, err := hashCompactionChainAck(ackingBlock) + hash, err := hashConsensusInfo(ackingBlock) s.Require().Nil(err) s.Equal(hash, block.ConsensusInfoParentHash) - s.True(verifyCompactionChainAckSignature( - pub, ackingBlock, block.CompactionChainAck.ConsensusSignature)) + s.True(verifyConsensusInfoSignature( + pub, ackingBlock, block.CompactionChainAck.ConsensusInfoSignature)) } // Modify Block.ConsensusTime and verify signature again. for _, block := range blocks { @@ -142,8 +142,8 @@ func (s *CryptoTestSuite) TestCompactionChainAckSignature() { } ackingBlock, exist := blockMap[block.CompactionChainAck.AckingBlockHash] s.Require().True(exist) - s.False(verifyCompactionChainAckSignature( - pub, ackingBlock, block.CompactionChainAck.ConsensusSignature)) + s.False(verifyConsensusInfoSignature( + pub, ackingBlock, block.CompactionChainAck.ConsensusInfoSignature)) } } |