aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-05 02:34:10 +0800
committerobscuren <geffobscura@gmail.com>2015-04-05 02:34:10 +0800
commitc39484bc4b099881c3aa164d33b5ba95c55f36fa (patch)
tree04f58fa6347f078305b061f08957af9b9da04737 /core/chain_manager.go
parenteff6a43419c6f0653880e05271811b93f4b6e56a (diff)
downloaddexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.tar
dexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.tar.gz
dexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.tar.bz2
dexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.tar.lz
dexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.tar.xz
dexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.tar.zst
dexon-c39484bc4b099881c3aa164d33b5ba95c55f36fa.zip
Added thread safe each
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r--core/chain_manager.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index b7b6279ca..639812b38 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -438,9 +438,9 @@ type queueEvent struct {
func (self *ChainManager) procFutureBlocks() {
blocks := make([]*types.Block, len(self.futureBlocks.blocks))
- for i, hash := range self.futureBlocks.hashes {
- blocks[i] = self.futureBlocks.Get(hash)
- }
+ self.futureBlocks.Each(func(i int, block *types.Block) {
+ blocks[i] = block
+ })
types.BlockBy(types.Number).Sort(blocks)
self.InsertChain(blocks)
@@ -536,7 +536,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
if len(chain) > 0 && glog.V(logger.Info) {
start, end := chain[0], chain[len(chain)-1]
- glog.Infof("imported %d blocks #%v [%x / %x]\n", len(chain), end.Number(), start.Hash().Bytes()[:4], end.Hash().Bytes()[:4])
+ glog.Infof("imported %d block(s) #%v [%x / %x]\n", len(chain), end.Number(), start.Hash().Bytes()[:4], end.Hash().Bytes()[:4])
}
go self.eventMux.Post(queueEvent)