diff options
author | Felix Lange <fjl@twurst.com> | 2015-06-27 09:08:50 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-06-30 00:51:48 +0800 |
commit | 76821d167acd7da15e13b23beeceb6779138ffe5 (patch) | |
tree | 73af5b18546dcb4db62e9e7f24d8bb103cdbfcef /core/chain_manager.go | |
parent | fccc7d71eb1e8e655f9bcd9c6d7856b70bbeda36 (diff) | |
download | dexon-76821d167acd7da15e13b23beeceb6779138ffe5.tar dexon-76821d167acd7da15e13b23beeceb6779138ffe5.tar.gz dexon-76821d167acd7da15e13b23beeceb6779138ffe5.tar.bz2 dexon-76821d167acd7da15e13b23beeceb6779138ffe5.tar.lz dexon-76821d167acd7da15e13b23beeceb6779138ffe5.tar.xz dexon-76821d167acd7da15e13b23beeceb6779138ffe5.tar.zst dexon-76821d167acd7da15e13b23beeceb6779138ffe5.zip |
core, eth, rpc: avoid unnecessary block header copying
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r-- | core/chain_manager.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 8a8078381..070b6b1d0 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -164,7 +164,7 @@ func (bc *ChainManager) SetHead(head *types.Block) { bc.mu.Lock() defer bc.mu.Unlock() - for block := bc.currentBlock; block != nil && block.Hash() != head.Hash(); block = bc.GetBlock(block.Header().ParentHash) { + for block := bc.currentBlock; block != nil && block.Hash() != head.Hash(); block = bc.GetBlock(block.ParentHash()) { bc.removeBlock(block) } @@ -269,7 +269,7 @@ func (bc *ChainManager) Reset() { bc.mu.Lock() defer bc.mu.Unlock() - for block := bc.currentBlock; block != nil; block = bc.GetBlock(block.Header().ParentHash) { + for block := bc.currentBlock; block != nil; block = bc.GetBlock(block.ParentHash()) { bc.removeBlock(block) } @@ -294,7 +294,7 @@ func (bc *ChainManager) ResetWithGenesisBlock(gb *types.Block) { bc.mu.Lock() defer bc.mu.Unlock() - for block := bc.currentBlock; block != nil; block = bc.GetBlock(block.Header().ParentHash) { + for block := bc.currentBlock; block != nil; block = bc.GetBlock(block.ParentHash()) { bc.removeBlock(block) } |