diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-20 19:57:47 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-20 19:57:47 +0800 |
commit | 66b29899c474abeab6c66060c9ea5bbff85b9efb (patch) | |
tree | 09ed7fd3f1d1506afcd4e4ebd79c4fa5a1181b3d /blockpool/blockpool.go | |
parent | d7564a9a25c06f0c9ad9440f02b09e20e0ca30bc (diff) | |
download | dexon-66b29899c474abeab6c66060c9ea5bbff85b9efb.tar.gz dexon-66b29899c474abeab6c66060c9ea5bbff85b9efb.tar.zst dexon-66b29899c474abeab6c66060c9ea5bbff85b9efb.zip |
use common.Hash as pool key, no string conversion needed
Diffstat (limited to 'blockpool/blockpool.go')
-rw-r--r-- | blockpool/blockpool.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/blockpool/blockpool.go b/blockpool/blockpool.go index 921d34949..09b9e7b0b 100644 --- a/blockpool/blockpool.go +++ b/blockpool/blockpool.go @@ -157,8 +157,8 @@ type BlockPool struct { tdSub event.Subscription // subscription to core.ChainHeadEvent td *big.Int // our own total difficulty - pool map[string]*entry // the actual blockpool - peers *peers // peers manager in peers.go + pool map[common.Hash]*entry // the actual blockpool + peers *peers // peers manager in peers.go status *status // info about blockpool (UI interface) in status.go @@ -210,7 +210,7 @@ func (self *BlockPool) Start() { self.hashSlicePool = make(chan []common.Hash, 150) self.status = newStatus() self.quit = make(chan bool) - self.pool = make(map[string]*entry) + self.pool = make(map[common.Hash]*entry) self.running = true self.peers = &peers{ @@ -789,13 +789,13 @@ func (self *BlockPool) getChild(sec *section) *section { func (self *BlockPool) get(hash common.Hash) *entry { self.lock.RLock() defer self.lock.RUnlock() - return self.pool[hash.Str()] + return self.pool[hash] } func (self *BlockPool) set(hash common.Hash, e *entry) { self.lock.Lock() defer self.lock.Unlock() - self.pool[hash.Str()] = e + self.pool[hash] = e } // accessor and setter for total difficulty @@ -817,7 +817,7 @@ func (self *BlockPool) remove(sec *section) { defer self.lock.Unlock() for _, node := range sec.nodes { - delete(self.pool, node.hash.Str()) + delete(self.pool, node.hash) } if sec.initialised && sec.poolRootIndex != 0 { self.status.lock.Lock() |