diff options
author | bojie <bojie@dexon.org> | 2019-03-13 15:38:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-13 15:38:33 +0800 |
commit | 8786160e28cf17c1125e26939b81ac59df5c260a (patch) | |
tree | 509444fbca35c37b1d073510e439a7b1f2f50768 /core/crypto/dkg/dkg_test.go | |
parent | 92d64e7e743f7afce6ab811bce4d57fc67297567 (diff) | |
download | dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.tar dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.tar.gz dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.tar.bz2 dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.tar.lz dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.tar.xz dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.tar.zst dexon-consensus-8786160e28cf17c1125e26939b81ac59df5c260a.zip |
core: recover DKG master private shares (#487)
Diffstat (limited to 'core/crypto/dkg/dkg_test.go')
-rw-r--r-- | core/crypto/dkg/dkg_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/crypto/dkg/dkg_test.go b/core/crypto/dkg/dkg_test.go index e097bdb..20dd908 100644 --- a/core/crypto/dkg/dkg_test.go +++ b/core/crypto/dkg/dkg_test.go @@ -328,6 +328,22 @@ func (s *DKGTestSuite) TestPublicKeySharesRLPEncodeDecode() { s.Require().True(reflect.DeepEqual(b, bb)) } +func (s *DKGTestSuite) TestPrivateKeySharesRLPEncodeDecode() { + privShares, _ := NewPrivateKeyShares(10) + + b, err := rlp.EncodeToBytes(privShares) + s.Require().NoError(err) + + var newPrivShares PrivateKeyShares + err = rlp.DecodeBytes(b, &newPrivShares) + s.Require().NoError(err) + + bb, err := rlp.EncodeToBytes(&newPrivShares) + s.Require().NoError(err) + + s.Require().True(reflect.DeepEqual(b, bb)) +} + func (s *DKGTestSuite) TestPublicKeySharesEquality() { var req = s.Require() IDs := s.genID(2) |