Move version to const and expose via Version()

This commit is contained in:
Taylor Gerring 2015-03-25 12:08:48 +01:00
parent d41341f77d
commit c956bcb13c

@ -18,6 +18,7 @@ import (
const ( const (
statusMsg = 0x0 statusMsg = 0x0
envelopesMsg = 0x01 envelopesMsg = 0x01
whisperVersion = 0x02
) )
type MessageEvent struct { type MessageEvent struct {
@ -56,7 +57,7 @@ func New() *Whisper {
// p2p whisper sub protocol handler // p2p whisper sub protocol handler
whisper.protocol = p2p.Protocol{ whisper.protocol = p2p.Protocol{
Name: "shh", Name: "shh",
Version: 2, Version: uint(whisperVersion),
Length: 2, Length: 2,
Run: whisper.msgHandler, Run: whisper.msgHandler,
} }
@ -64,6 +65,10 @@ func New() *Whisper {
return whisper return whisper
} }
func (self *Whisper) Version() uint {
return self.protocol.Version
}
func (self *Whisper) Start() { func (self *Whisper) Start() {
wlogger.Infoln("Whisper started") wlogger.Infoln("Whisper started")
go self.update() go self.update()