mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
core: remove ChainManager Reset() as it would never be called
This commit is contained in:
parent
55bdcfaeac
commit
14047eca3d
1 changed files with 9 additions and 18 deletions
|
|
@ -226,20 +226,16 @@ func (bc *ChainManager) recover() bool {
|
|||
|
||||
func (bc *ChainManager) setLastState() error {
|
||||
head := GetHeadBlockHash(bc.chainDb)
|
||||
if head != (common.Hash{}) {
|
||||
block := bc.GetBlock(head)
|
||||
if block != nil {
|
||||
bc.currentBlock = block
|
||||
} else {
|
||||
glog.Infof("LastBlock (%x) not found. Recovering...\n", head)
|
||||
if bc.recover() {
|
||||
glog.Infof("Recover successful")
|
||||
} else {
|
||||
glog.Fatalf("Recover failed. Please report")
|
||||
}
|
||||
}
|
||||
block := bc.GetBlock(head)
|
||||
if block != nil {
|
||||
bc.currentBlock = block
|
||||
} else {
|
||||
bc.Reset()
|
||||
glog.Infof("LastBlock (%x) not found. Recovering...\n", head)
|
||||
if bc.recover() {
|
||||
glog.Infof("Recover successful")
|
||||
} else {
|
||||
glog.Fatalf("Recover failed. Please report")
|
||||
}
|
||||
}
|
||||
bc.td = bc.GetTd(bc.currentBlock.Hash())
|
||||
bc.currentGasLimit = CalcGasLimit(bc.currentBlock)
|
||||
|
|
@ -251,11 +247,6 @@ func (bc *ChainManager) setLastState() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Reset purges the entire blockchain, restoring it to its genesis state.
|
||||
func (bc *ChainManager) Reset() {
|
||||
bc.ResetWithGenesisBlock(bc.genesisBlock)
|
||||
}
|
||||
|
||||
// ResetWithGenesisBlock purges the entire blockchain, restoring it to the
|
||||
// specified genesis state.
|
||||
func (bc *ChainManager) ResetWithGenesisBlock(genesis *types.Block) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue