diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-26 17:26:42 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-26 17:26:42 +0800 |
commit | 0ed19d9f2024744ba93d0e34db6939766b3cfed5 (patch) | |
tree | 76f36ff8ed0a21bcb9976e6d9919401990061b60 /ethchain/block_chain.go | |
parent | 39cb34850a573ea9b2ea73eb624139684502bc79 (diff) | |
download | dexon-0ed19d9f2024744ba93d0e34db6939766b3cfed5.tar.gz dexon-0ed19d9f2024744ba93d0e34db6939766b3cfed5.tar.zst dexon-0ed19d9f2024744ba93d0e34db6939766b3cfed5.zip |
Logging, variable rearrangement
Diffstat (limited to 'ethchain/block_chain.go')
-rw-r--r-- | ethchain/block_chain.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go index 19b5248d7..286a158ba 100644 --- a/ethchain/block_chain.go +++ b/ethchain/block_chain.go @@ -174,18 +174,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 { @@ -231,6 +225,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 { + ethutil.Config.Log.Debugf("Unexpected error during GetChainFromHash: Unable to find %x\n", currentHash) + break + } + currentHash = block.PrevHash chain = append(chain, block.Value().Val) |