GetBlockHashesFromHash(hash, max) gives back max hashes starting from PARENT of hash

This commit is contained in:
zelig 2015-01-09 05:03:26 +00:00
parent db4aaedcbd
commit 3bdf28c1fe
1 changed files with 1 additions and 3 deletions

View File

@ -238,13 +238,11 @@ func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain
// XXX Could be optimised by using a different database which only holds hashes (i.e., linked list) // XXX Could be optimised by using a different database which only holds hashes (i.e., linked list)
for i := uint64(0); i < max; i++ { for i := uint64(0); i < max; i++ {
block = self.GetBlock(block.Header().ParentHash)
chain = append(chain, block.Hash()) chain = append(chain, block.Hash())
if block.Header().Number.Cmp(ethutil.Big0) <= 0 { if block.Header().Number.Cmp(ethutil.Big0) <= 0 {
break break
} }
block = self.GetBlock(block.Header().ParentHash)
} }
return return