mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 05:11:21 +00:00
fix tests: propose and full round suites
This commit is contained in:
@ -137,7 +137,7 @@ func addVoteToFromMany(to *ConsensusState, votes []*types.Vote, froms ...*valida
|
||||
func addVoteToFrom(to *ConsensusState, from *validatorStub, vote *types.Vote) {
|
||||
valIndex, _ := to.Validators.GetByAddress(from.PrivValidator.Address)
|
||||
|
||||
to.msgQueue <- msgInfo{msg: &VoteMessage{valIndex, vote}}
|
||||
to.peerMsgQueue <- msgInfo{msg: &VoteMessage{valIndex, vote}}
|
||||
// added, err := to.TryAddVote(valIndex, vote, "")
|
||||
/*
|
||||
if _, ok := err.(*types.ErrVoteConflictingSignature); ok {
|
||||
@ -298,14 +298,20 @@ func simpleConsensusState(nValidators int) (*ConsensusState, []*validatorStub) {
|
||||
cs := NewConsensusState(state, proxyAppCtxCon, blockStore, mempool)
|
||||
cs.SetPrivValidator(privVals[0])
|
||||
|
||||
evsw := events.NewEventSwitch()
|
||||
cs.SetFireable(evsw)
|
||||
|
||||
// read off the NewHeightStep from updateToState
|
||||
// from the updateToState in NewConsensusState
|
||||
<-cs.NewStepCh()
|
||||
|
||||
evsw := events.NewEventSwitch()
|
||||
cs.SetFireable(evsw)
|
||||
evsw.OnStart()
|
||||
go func() {
|
||||
for {
|
||||
<-cs.NewStepCh()
|
||||
}
|
||||
}()
|
||||
|
||||
// start the transition routines
|
||||
cs.startRoutines()
|
||||
// cs.startRoutines()
|
||||
|
||||
for i := 0; i < nValidators; i++ {
|
||||
vss[i] = NewValidatorStub(privVals[i])
|
||||
@ -316,6 +322,16 @@ func simpleConsensusState(nValidators int) (*ConsensusState, []*validatorStub) {
|
||||
return cs, vss
|
||||
}
|
||||
|
||||
func subscribeToEvent(cs *ConsensusState, eventID string) chan interface{} {
|
||||
evsw := cs.evsw.(*events.EventSwitch)
|
||||
// listen for new round
|
||||
ch := make(chan interface{}, 10)
|
||||
evsw.AddListenerForEvent("tester", eventID, func(data types.EventData) {
|
||||
ch <- data
|
||||
})
|
||||
return ch
|
||||
}
|
||||
|
||||
func randGenesisState(numValidators int, randPower bool, minPower int64) (*sm.State, []*types.PrivValidator) {
|
||||
db := dbm.NewMemDB()
|
||||
genDoc, privValidators := randGenesisDoc(numValidators, randPower, minPower)
|
||||
@ -343,3 +359,8 @@ func randGenesisDoc(numValidators int, randPower bool, minPower int64) (*types.G
|
||||
}, privValidators
|
||||
|
||||
}
|
||||
|
||||
func startTestRound(cs *ConsensusState, height, round int) {
|
||||
cs.EnterNewRound(height, round)
|
||||
cs.startRoutines(0)
|
||||
}
|
||||
|
Reference in New Issue
Block a user