diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-21 07:57:18 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-21 07:57:18 +0800 |
commit | 069c87b960c48864dc4f1b9086adf582e1dc88a9 (patch) | |
tree | 4d24df73aa5a3e7b8db9f7b1178f4c4732e325b2 /whisper/whisper.go | |
parent | 7c4ff3abb4693bf93b2b348f572f14f2cfcf9142 (diff) | |
download | go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.tar go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.tar.gz go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.tar.bz2 go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.tar.lz go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.tar.xz go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.tar.zst go-tangerine-069c87b960c48864dc4f1b9086adf582e1dc88a9.zip |
whisper: use common.Hash
Diffstat (limited to 'whisper/whisper.go')
-rw-r--r-- | whisper/whisper.go | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/whisper/whisper.go b/whisper/whisper.go index 908df973c..dbd4fc85f 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -1,12 +1,12 @@ package whisper import ( - "bytes" "crypto/ecdsa" "errors" "sync" "time" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/ecies" "github.com/ethereum/go-ethereum/event/filter" @@ -15,26 +15,6 @@ import ( "gopkg.in/fatih/set.v0" ) -// MOVE ME -type Hash struct { - hash string -} - -var EmptyHash Hash - -func H(hash []byte) Hash { - return Hash{string(hash)} -} -func HS(hash string) Hash { - return Hash{hash} -} - -func (self Hash) Compare(other Hash) int { - return bytes.Compare([]byte(self.hash), []byte(other.hash)) -} - -// MOVE ME END - const ( statusMsg = 0x0 envelopesMsg = 0x01 @@ -55,7 +35,7 @@ type Whisper struct { filters *filter.Filters mmu sync.RWMutex - messages map[Hash]*Envelope + messages map[common.Hash]*Envelope expiry map[uint32]*set.SetNonTS quit chan struct{} @@ -65,7 +45,7 @@ type Whisper struct { func New() *Whisper { whisper := &Whisper{ - messages: make(map[Hash]*Envelope), + messages: make(map[common.Hash]*Envelope), filters: filter.New(), expiry: make(map[uint32]*set.SetNonTS), quit: make(chan struct{}), @@ -239,7 +219,7 @@ func (self *Whisper) expire() { } hashSet.Each(func(v interface{}) bool { - delete(self.messages, v.(Hash)) + delete(self.messages, v.(common.Hash)) return true }) self.expiry[then].Clear() |