aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block_chain.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-26 23:37:56 +0800
committerzelig <viktor.tron@gmail.com>2014-06-26 23:37:56 +0800
commitda38faa8f7c0f2a6620b54e46fc38a201845e104 (patch)
tree2656f980c91f9f93d98215867f75c9253e330019 /ethchain/block_chain.go
parent098136b68198083a47408ec5c04cd0c8f9fdcc87 (diff)
parent0ed19d9f2024744ba93d0e34db6939766b3cfed5 (diff)
downloadgo-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.tar
go-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.tar.gz
go-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.tar.bz2
go-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.tar.lz
go-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.tar.xz
go-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.tar.zst
go-tangerine-da38faa8f7c0f2a6620b54e46fc38a201845e104.zip
merge upstream; fix port in use warning; new logger API
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)