aboutsummaryrefslogtreecommitdiffstats
path: root/core/utils/nodeset-cache_test.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-07 17:21:08 +0800
committerGitHub <noreply@github.com>2019-01-07 17:21:08 +0800
commit21c420db895b1aa48709982cd145a119c74de6fa (patch)
treea8cd9a9bc5e8c22a21812f0e00939f3fbd92db89 /core/utils/nodeset-cache_test.go
parent8d1069b61d847662d37f504937a346c56d6cb0eb (diff)
downloadtangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.tar
tangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.tar.gz
tangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.tar.bz2
tangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.tar.lz
tangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.tar.xz
tangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.tar.zst
tangerine-consensus-21c420db895b1aa48709982cd145a119c74de6fa.zip
core: BA 3.0 (#408)
* Add v3 enum * Add BA leader calculation * Fast BA * Add unittest for Fast BA * Add comment * Select leader in notarySet
Diffstat (limited to 'core/utils/nodeset-cache_test.go')
-rw-r--r--core/utils/nodeset-cache_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/utils/nodeset-cache_test.go b/core/utils/nodeset-cache_test.go
index 27c8c83..9e6ceee 100644
--- a/core/utils/nodeset-cache_test.go
+++ b/core/utils/nodeset-cache_test.go
@@ -19,6 +19,7 @@ package utils
import (
"testing"
+ "time"
"github.com/dexon-foundation/dexon-consensus/common"
"github.com/dexon-foundation/dexon-consensus/core/crypto"
@@ -38,6 +39,8 @@ func (g *nsIntf) Configuration(round uint64) (cfg *types.Config) {
NotarySetSize: 7,
DKGSetSize: 7,
NumChains: 4,
+ LambdaBA: 250 * time.Millisecond,
+ RoundInterval: 60 * time.Second,
}
}
func (g *nsIntf) CRS(round uint64) (b common.Hash) { return g.crs }
@@ -91,6 +94,15 @@ func (s *NodeSetCacheTestSuite) TestBasicUsage() {
dkgSet, err := cache.GetDKGSet(0)
req.NoError(err)
chk(cache, 0, dkgSet)
+ leaderNode, err := cache.GetLeaderNode(types.Position{
+ Round: uint64(0),
+ ChainID: uint32(3),
+ Height: uint64(10),
+ })
+ req.NoError(err)
+ chk(cache, 0, map[types.NodeID]struct{}{
+ leaderNode: struct{}{},
+ })
// Try to get round 1.
nodeSet1, err := cache.GetNodeSet(1)
req.NoError(err)