aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-19 03:26:43 +0800
committerobscuren <geffobscura@gmail.com>2015-04-19 03:26:43 +0800
commitd34e4dc5ac2fc80c727e01ad175d3137316247a1 (patch)
tree66065ada5446447eda0a6ecafe2f5e85afdc997f
parentc8cc523d4d073f3405057554b5a0881118eba6f1 (diff)
parent84f1af6413b172c7c88d567e8b9033197196b5bd (diff)
downloaddexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.tar
dexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.tar.gz
dexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.tar.bz2
dexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.tar.lz
dexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.tar.xz
dexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.tar.zst
dexon-d34e4dc5ac2fc80c727e01ad175d3137316247a1.zip
Merge branch 'develop' into downloader-proto
-rw-r--r--core/chain_manager.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 7e792864a..8371a129d 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -366,6 +366,12 @@ func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block {
self.mu.RLock()
defer self.mu.RUnlock()
+ return self.getBlockByNumber(num)
+
+}
+
+// non blocking version
+func (self *ChainManager) getBlockByNumber(num uint64) *types.Block {
key, _ := self.blockDb.Get(append(blockNumPre, big.NewInt(int64(num)).Bytes()...))
if len(key) == 0 {
return nil
@@ -507,7 +513,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
glog.Infof("Split detected. New head #%v (%x) TD=%v, was #%v (%x) TD=%v\n", block.Header().Number, hash[:4], td, cblock.Header().Number, chash[:4], self.td)
}
// during split we merge two different chains and create the new canonical chain
- self.merge(cblock, block)
+ self.merge(self.getBlockByNumber(block.NumberU64()), block)
queue[i] = ChainSplitEvent{block, logs}
queueEvent.splitCount++