mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
32 lines
739 B
Go
32 lines
739 B
Go
|
package check
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/ledgerwatch/turbo-geth/log"
|
||
|
"github.com/ledgerwatch/turbo-geth/turbo/stages/headerdownload"
|
||
|
)
|
||
|
|
||
|
func Check(filesDir string) error {
|
||
|
log.Info("Checking", "directory", filesDir)
|
||
|
hd := headerdownload.NewHeaderDownload(
|
||
|
filesDir,
|
||
|
32*1024, /* bufferLimit */
|
||
|
16*1024, /* tipLimit */
|
||
|
1024, /* initPowDepth */
|
||
|
nil,
|
||
|
nil,
|
||
|
3600, /* newAnchor future limit */
|
||
|
3600, /* newAnchor past limit */
|
||
|
)
|
||
|
if recovered, err := hd.RecoverFromFiles(uint64(time.Now().Unix())); err != nil || !recovered {
|
||
|
if err != nil {
|
||
|
log.Error("Recovery from file failed, will start from scratch", "error", err)
|
||
|
} else {
|
||
|
log.Info("Nothing recovered")
|
||
|
}
|
||
|
}
|
||
|
log.Info(hd.AnchorState())
|
||
|
return nil
|
||
|
}
|