2019-02-25 22:44:14 +00:00
|
|
|
package pubsub
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
// EventType is an enum
|
|
|
|
// representing the types of messages we can subscribe to
|
2019-02-25 22:44:14 +00:00
|
|
|
type EventType int
|
|
|
|
|
|
|
|
const (
|
2019-03-17 18:26:35 +00:00
|
|
|
// NewBlock is called When blockchain connects a new block, it will emit an NewBlock Event
|
|
|
|
NewBlock EventType = iota
|
|
|
|
// BadBlock is called When blockchain declines a block, it will emit a new block event
|
|
|
|
BadBlock
|
|
|
|
// BadHeader is called When blockchain rejects a Header, it will emit this event
|
|
|
|
BadHeader
|
2019-02-25 22:44:14 +00:00
|
|
|
)
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
// Event represents a new Event that a subscriber can listen to
|
2019-02-25 22:44:14 +00:00
|
|
|
type Event struct {
|
|
|
|
Type EventType // E.g. event.NewBlock
|
|
|
|
data []byte // Raw information
|
|
|
|
}
|