diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-04-01 19:36:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 19:36:40 +0800 |
commit | b11406ecd961bc26f4382e06c8061708a58063e0 (patch) | |
tree | 3bdb15f8fe25736b67838e9f159462cf17697636 | |
parent | ecc5e12b1ac4826e302607769f5b831ab4c27046 (diff) | |
download | dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.tar dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.tar.gz dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.tar.bz2 dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.tar.lz dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.tar.xz dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.tar.zst dexon-consensus-b11406ecd961bc26f4382e06c8061708a58063e0.zip |
core: expose CalcQualifyNodes function (#541)
-rw-r--r-- | core/types/dkg/dkg.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/types/dkg/dkg.go b/core/types/dkg/dkg.go index 6572d1e..301cef7 100644 --- a/core/types/dkg/dkg.go +++ b/core/types/dkg/dkg.go @@ -320,7 +320,8 @@ func (gpk *GroupPublicKey) VerifySignature( return gpk.GroupPublicKey.VerifySignature(hash, sig) } -func calcQualifyNodes( +// CalcQualifyNodes returns the qualified nodes. +func CalcQualifyNodes( mpks []*MasterPublicKey, complaints []*Complaint, threshold int) ( qualifyIDs cryptoDKG.IDs, qualifyNodeIDs map[types.NodeID]struct{}, err error) { if len(mpks) < threshold { @@ -371,7 +372,7 @@ func NewGroupPublicKey( threshold int) ( *GroupPublicKey, error) { qualifyIDs, qualifyNodeIDs, err := - calcQualifyNodes(mpks, complaints, threshold) + CalcQualifyNodes(mpks, complaints, threshold) if err != nil { return nil, err } @@ -417,7 +418,7 @@ func NewNodePublicKeys( threshold int) ( *NodePublicKeys, error) { qualifyIDs, qualifyNodeIDs, err := - calcQualifyNodes(mpks, complaints, threshold) + CalcQualifyNodes(mpks, complaints, threshold) if err != nil { return nil, err } |