|
|
@ -174,18 +174,12 @@ func (bc *BlockChain) ResetTillBlockHash(hash []byte) error { |
|
|
|
bc.LastBlockHash = bc.genesisBlock.Hash() |
|
|
|
bc.LastBlockHash = bc.genesisBlock.Hash() |
|
|
|
bc.LastBlockNumber = 1 |
|
|
|
bc.LastBlockNumber = 1 |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// TODO: Somehow this doesn't really give the right numbers, double check.
|
|
|
|
|
|
|
|
// TODO: Change logs into debug lines
|
|
|
|
|
|
|
|
returnTo = bc.GetBlock(hash) |
|
|
|
returnTo = bc.GetBlock(hash) |
|
|
|
bc.CurrentBlock = returnTo |
|
|
|
bc.CurrentBlock = returnTo |
|
|
|
bc.LastBlockHash = returnTo.Hash() |
|
|
|
bc.LastBlockHash = returnTo.Hash() |
|
|
|
//info := bc.BlockInfo(returnTo)
|
|
|
|
|
|
|
|
bc.LastBlockNumber = returnTo.Number.Uint64() |
|
|
|
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
|
|
|
|
// Manually reset the last sync block
|
|
|
|
err := ethutil.Config.Db.Delete(lastBlock.Hash()) |
|
|
|
err := ethutil.Config.Db.Delete(lastBlock.Hash()) |
|
|
|
if err != nil { |
|
|
|
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++ { |
|
|
|
for i := uint64(0); bytes.Compare(currentHash, hash) != 0 && num >= parentNumber && i < count; i++ { |
|
|
|
// Get the block of the chain
|
|
|
|
// Get the block of the chain
|
|
|
|
block := bc.GetBlock(currentHash) |
|
|
|
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 |
|
|
|
currentHash = block.PrevHash |
|
|
|
|
|
|
|
|
|
|
|
chain = append(chain, block.Value().Val) |
|
|
|
chain = append(chain, block.Value().Val) |
|
|
|