consensus: test validator set change

This commit is contained in:
Ethan Buchman
2016-11-23 18:20:46 -05:00
parent 65496ace20
commit 2f9063c1d6
8 changed files with 464 additions and 283 deletions

View File

@@ -4,7 +4,7 @@ import (
"github.com/tendermint/tendermint/types"
)
// NOTE: this is blocking
// NOTE: if chanCap=0, this blocks on the event being consumed
func subscribeToEvent(evsw types.EventSwitch, receiver, eventID string, chanCap int) chan interface{} {
// listen for event
ch := make(chan interface{}, chanCap)
@@ -13,3 +13,14 @@ func subscribeToEvent(evsw types.EventSwitch, receiver, eventID string, chanCap
})
return ch
}
// NOTE: this blocks on receiving a response after the event is consumed
func subscribeToEventRespond(evsw types.EventSwitch, receiver, eventID string) chan interface{} {
// listen for event
ch := make(chan interface{})
types.AddListenerForEvent(evsw, receiver, eventID, func(data types.TMEventData) {
ch <- data
<-ch
})
return ch
}