aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block_chain.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/block_chain.go')
-rw-r--r--ethchain/block_chain.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go
index f964e0e3a..05b2564cf 100644
--- a/ethchain/block_chain.go
+++ b/ethchain/block_chain.go
@@ -176,18 +176,12 @@ func (bc *BlockChain) ResetTillBlockHash(hash []byte) error {
bc.LastBlockHash = bc.genesisBlock.Hash()
bc.LastBlockNumber = 1
} else {
- // TODO: Somehow this doesn't really give the right numbers, double check.
- // TODO: Change logs into debug lines
returnTo = bc.GetBlock(hash)
bc.CurrentBlock = returnTo
bc.LastBlockHash = returnTo.Hash()
- //info := bc.BlockInfo(returnTo)
bc.LastBlockNumber = returnTo.Number.Uint64()
}
- // XXX Why are we resetting? This is the block chain, it has nothing to do with states
- //bc.Ethereum.StateManager().PrepareDefault(returnTo)
-
// Manually reset the last sync block
err := ethutil.Config.Db.Delete(lastBlock.Hash())
if err != nil {
@@ -233,6 +227,11 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} {
for i := uint64(0); bytes.Compare(currentHash, hash) != 0 && num >= parentNumber && i < count; i++ {
// Get the block of the chain
block := bc.GetBlock(currentHash)
+ if block == nil {
+ chainlogger.Debugf("Unexpected error during GetChainFromHash: Unable to find %x\n", currentHash)
+ break
+ }
+
currentHash = block.PrevHash
chain = append(chain, block.Value().Val)