aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/stopper_test.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-09-20 09:09:37 +0800
committerGitHub <noreply@github.com>2018-09-20 09:09:37 +0800
commit421d72b2d796195178104a0eb1dedf319ba8664c (patch)
treef32f15c167989905494eca1891c3240b80dac1d6 /core/test/stopper_test.go
parent37f117d35c6617e1944d45e001e03813a6a278ed (diff)
downloaddexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar
dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.gz
dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.bz2
dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.lz
dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.xz
dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.zst
dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.zip
Rename validator* to node* (#120)
Diffstat (limited to 'core/test/stopper_test.go')
-rw-r--r--core/test/stopper_test.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/core/test/stopper_test.go b/core/test/stopper_test.go
index 9a0e430..262e178 100644
--- a/core/test/stopper_test.go
+++ b/core/test/stopper_test.go
@@ -33,20 +33,20 @@ type StopperTestSuite struct {
func (s *StopperTestSuite) TestStopByConfirmedBlocks() {
// This test case makes sure this stopper would stop when
- // all validators confirmed at least 'x' count of blocks produced
+ // all nodes confirmed at least 'x' count of blocks produced
// by themselves.
var (
req = s.Require()
)
- apps := make(map[types.ValidatorID]*App)
- dbs := make(map[types.ValidatorID]blockdb.BlockDatabase)
- validators := GenerateRandomValidatorIDs(2)
+ apps := make(map[types.NodeID]*App)
+ dbs := make(map[types.NodeID]blockdb.BlockDatabase)
+ nodes := GenerateRandomNodeIDs(2)
db, err := blockdb.NewMemBackedBlockDB()
req.Nil(err)
- for _, vID := range validators {
- apps[vID] = NewApp()
- dbs[vID] = db
+ for _, nID := range nodes {
+ apps[nID] = NewApp()
+ dbs[nID] = db
}
deliver := func(blocks []*types.Block) {
hashes := common.Hashes{}
@@ -54,8 +54,8 @@ func (s *StopperTestSuite) TestStopByConfirmedBlocks() {
hashes = append(hashes, b.Hash)
req.Nil(db.Put(*b))
}
- for _, vID := range validators {
- app := apps[vID]
+ for _, nID := range nodes {
+ app := apps[nID]
for _, h := range hashes {
app.StronglyAcked(h)
}
@@ -67,35 +67,35 @@ func (s *StopperTestSuite) TestStopByConfirmedBlocks() {
}
stopper := NewStopByConfirmedBlocks(2, apps, dbs)
b00 := &types.Block{
- ProposerID: validators[0],
+ ProposerID: nodes[0],
Hash: common.NewRandomHash(),
}
deliver([]*types.Block{b00})
b10 := &types.Block{
- ProposerID: validators[1],
+ ProposerID: nodes[1],
Hash: common.NewRandomHash(),
}
b11 := &types.Block{
- ProposerID: validators[1],
+ ProposerID: nodes[1],
ParentHash: b10.Hash,
Hash: common.NewRandomHash(),
}
deliver([]*types.Block{b10, b11})
- req.False(stopper.ShouldStop(validators[1]))
+ req.False(stopper.ShouldStop(nodes[1]))
b12 := &types.Block{
- ProposerID: validators[1],
+ ProposerID: nodes[1],
ParentHash: b11.Hash,
Hash: common.NewRandomHash(),
}
deliver([]*types.Block{b12})
- req.False(stopper.ShouldStop(validators[1]))
+ req.False(stopper.ShouldStop(nodes[1]))
b01 := &types.Block{
- ProposerID: validators[0],
+ ProposerID: nodes[0],
ParentHash: b00.Hash,
Hash: common.NewRandomHash(),
}
deliver([]*types.Block{b01})
- req.True(stopper.ShouldStop(validators[0]))
+ req.True(stopper.ShouldStop(nodes[0]))
}
func TestStopper(t *testing.T) {