aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/stopper_test.go
diff options
context:
space:
mode:
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) {