Skip to content

Commit

Permalink
Merge branch 'release/0.9.26'
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed May 28, 2015
2 parents f082c1b + 12b9060 commit 0e703d9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions core/chain_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,21 +680,20 @@ func (self *ChainManager) diff(oldBlock, newBlock *types.Block) (types.Blocks, e
// first reduce whoever is higher bound
if oldBlock.NumberU64() > newBlock.NumberU64() {
// reduce old chain
for oldBlock = oldBlock; oldBlock.NumberU64() != newBlock.NumberU64(); oldBlock = self.GetBlock(oldBlock.ParentHash()) {
if oldBlock == nil {
return nil, fmt.Errorf("Invalid old chain")
}
for oldBlock = oldBlock; oldBlock != nil && oldBlock.NumberU64() != newBlock.NumberU64(); oldBlock = self.GetBlock(oldBlock.ParentHash()) {
}
} else {
// reduce new chain and append new chain blocks for inserting later on
for newBlock = newBlock; newBlock.NumberU64() != oldBlock.NumberU64(); newBlock = self.GetBlock(newBlock.ParentHash()) {
if newBlock == nil {
return nil, fmt.Errorf("Invalid new chain")
}

for newBlock = newBlock; newBlock != nil && newBlock.NumberU64() != oldBlock.NumberU64(); newBlock = self.GetBlock(newBlock.ParentHash()) {
newChain = append(newChain, newBlock)
}
}
if oldBlock == nil {
return nil, fmt.Errorf("Invalid old chain")
}
if newBlock == nil {
return nil, fmt.Errorf("Invalid new chain")
}

numSplit := newBlock.Number()
for {
Expand Down

0 comments on commit 0e703d9

Please sign in to comment.