linter: address deadcode, implement incremental lint testing

This commit is contained in:
Zach Ramsay
2017-09-21 13:54:34 -04:00
committed by Ethan Buchman
parent 15651a931e
commit 48aca642e3
5 changed files with 39 additions and 0 deletions

18
consensus/common.go Normal file
View File

@@ -0,0 +1,18 @@
package consensus
import (
"github.com/tendermint/tendermint/types"
)
// XXX: WARNING: this function can halt the consensus as firing events is synchronous.
// Make sure to read off the channels, and in the case of subscribeToEventRespond, to write back on it
// 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)
types.AddListenerForEvent(evsw, receiver, eventID, func(data types.TMEventData) {
ch <- data
})
return ch
}