diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-02 11:45:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 11:45:34 +0800 |
commit | 658662d42d30c58e4f3951f5c1e99688de295397 (patch) | |
tree | 41bb0f9129403eb1905172dc8409eac6761d5fea /core/types | |
parent | 9c33b9dc8aa59d414a6697f1e2d036e5581860ee (diff) | |
download | dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.tar dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.tar.gz dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.tar.bz2 dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.tar.lz dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.tar.xz dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.tar.zst dexon-consensus-658662d42d30c58e4f3951f5c1e99688de295397.zip |
core: run DKG and CRS at background. (#155)
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/dkg.go | 1 | ||||
-rw-r--r-- | core/types/nodeset.go | 13 | ||||
-rw-r--r-- | core/types/nodeset_test.go | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/core/types/dkg.go b/core/types/dkg.go index 7738783..df9d8e3 100644 --- a/core/types/dkg.go +++ b/core/types/dkg.go @@ -73,6 +73,7 @@ type DKGPartialSignatureType uint32 const ( TSigConfigurationBlock DKGPartialSignatureType = iota TSigNotaryAck + TSigCRS ) // DKGPartialSignature describe a partial signature in DKG protocol. diff --git a/core/types/nodeset.go b/core/types/nodeset.go index 6b78cab..83c64a7 100644 --- a/core/types/nodeset.go +++ b/core/types/nodeset.go @@ -22,6 +22,7 @@ import ( "encoding/binary" "math/big" + "github.com/dexon-foundation/dexon-consensus-core/common" "github.com/dexon-foundation/dexon-consensus-core/core/crypto" ) @@ -71,27 +72,27 @@ func NewNodeSet() *NodeSet { } // NewNotarySetTarget is the target for getting Notary Set. -func NewNotarySetTarget(crs []byte, shardID, chainID uint32) SubSetTarget { +func NewNotarySetTarget(crs common.Hash, chainID uint32) SubSetTarget { binaryChainID := make([]byte, 4) binary.LittleEndian.PutUint32(binaryChainID, chainID) - return newTarget(targetNotarySet, crs, binaryChainID) + return newTarget(targetNotarySet, crs[:], binaryChainID) } // NewWitnessSetTarget is the target for getting DKG Set. -func NewWitnessSetTarget(crs []byte, round uint64) SubSetTarget { +func NewWitnessSetTarget(crs common.Hash, round uint64) SubSetTarget { binaryRound := make([]byte, 8) binary.LittleEndian.PutUint64(binaryRound, round) - return newTarget(targetWitnessSet, crs, binaryRound) + return newTarget(targetWitnessSet, crs[:], binaryRound) } // NewDKGSetTarget is the target for getting DKG Set. -func NewDKGSetTarget(crs []byte, round uint64) SubSetTarget { +func NewDKGSetTarget(crs common.Hash, round uint64) SubSetTarget { binaryRound := make([]byte, 8) binary.LittleEndian.PutUint64(binaryRound, round) - return newTarget(targetDKGSet, crs, binaryRound) + return newTarget(targetDKGSet, crs[:], binaryRound) } // Add a NodeID to the set. diff --git a/core/types/nodeset_test.go b/core/types/nodeset_test.go index 021a0a4..d6f55c2 100644 --- a/core/types/nodeset_test.go +++ b/core/types/nodeset_test.go @@ -35,7 +35,7 @@ func (s *NodeSetTestSuite) TestGetSubSet() { for len(nodes.IDs) < total { nodes.IDs[NodeID{common.NewRandomHash()}] = struct{}{} } - target := NewNotarySetTarget(crs[:], 0, 0) + target := NewNotarySetTarget(crs, 0) ranks := make(map[NodeID]*nodeRank, len(nodes.IDs)) for nID := range nodes.IDs { ranks[nID] = newNodeRank(nID, target) |