mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
7554428884
* Splitting sentry and downloader - the beginning * A bit more * More on sentry * More gRPC * Sentry and downloader separated * Update binding for stable version of grpc * Better bufferSize flag * Fix lint * Send pelanties * Fix lint * Remove hard-coded tips on connect * Tidy the logs a bit * Deal with hardTips on Recovery * Print hard tips * Hide empty anchors * Request headers after receiving a message * Better waking up * Print hard-coded block numbers * Print outgoing requests * Debug logging * In the middle protection * Sentry not to lose peers when core disconnects
33 lines
815 B
Go
33 lines
815 B
Go
package check
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
"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()), make(map[common.Hash]struct{})); 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
|
|
}
|