diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-26 17:13:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-26 17:13:37 +0800 |
commit | 7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe (patch) | |
tree | 41b823a05f81615558a37567dab85e2958b59329 /core/crypto/dkg/utils.go | |
parent | 663817d3e0d5a3c28cb0c5e378a533e242af5fdf (diff) | |
download | dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.gz dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.bz2 dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.lz dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.xz dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.zst dexon-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.zip |
crypto: sigtopub to crypto package. remove SigToPubFn (#141)
Diffstat (limited to 'core/crypto/dkg/utils.go')
-rw-r--r-- | core/crypto/dkg/utils.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/crypto/dkg/utils.go b/core/crypto/dkg/utils.go index 967973d..45c4a27 100644 --- a/core/crypto/dkg/utils.go +++ b/core/crypto/dkg/utils.go @@ -38,18 +38,20 @@ func RecoverSignature(sigs []PartialSignature, signerIDs IDs) ( crypto.Signature, error) { blsSigs := make([]bls.Sign, len(sigs)) for i, sig := range sigs { - if len(sig) == 0 { - return nil, ErrEmptySignature + if len(sig.Signature) == 0 { + return crypto.Signature{}, ErrEmptySignature } - if err := blsSigs[i].Deserialize([]byte(sig)); err != nil { - return nil, err + if err := blsSigs[i].Deserialize([]byte(sig.Signature)); err != nil { + return crypto.Signature{}, err } } var recoverSig bls.Sign if err := recoverSig.Recover(blsSigs, []bls.ID(signerIDs)); err != nil { - return nil, err + return crypto.Signature{}, err } - return crypto.Signature(recoverSig.Serialize()), nil + return crypto.Signature{ + Type: cryptoType, + Signature: recoverSig.Serialize()}, nil } // RecoverGroupPublicKey recovers group public key. |