mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-27 22:28:21 +00:00
5834189019
* Only insert hard-coded tips if both DB and files recovery failed * Prevent deadlock * Report some efficiency numbers * Count properly unrequested bodies * Initialise allRequests * Increase timeout * Fixes to scheduling * Small fix * Simplified scheduling * Remove separate bodyLoop goroutine * Update from DB at the beginnig of block bodies forward * Timeout for repeating the request cycle * Fix timeout * Fix * Increase timeout * Increase timeout * Try to make flow if possible * Fix flow * Lower timeout * timeout for each blockNum * Adjustable timeout * Better log timing * Track peers * copy peerID * fix scheduling * Too much logging * Print delivery speed * Print committed blocks * Fix race * Sentry to only reset back-off timer when response to a request is received * Print bytes/sec and wasted traffic * Fix bandwidth accounting * Less logging * not to wake up on deliveries * Spam every second * Print peer map * Fix npe, print requests * Timestamps * Improved logging * Penalty for peers * Log penalties only when disconnecting * Try with smaller window * window parameter * Dealing with partially delivered requests * Init bodyReq * Fix array index * More fix for NPE * More NPE checks * Print out body progress and header progress * Fix ending condition * Bring back waking up and penalties * Fix duplicate tip * Duplicate segment * Fix lint * Fix lint * fix lint * Fix lint * Hard coded headers in the source files * Fix lint * Replace hix-sized header serialisation with rlp (to support clique) * Remove anchor records from the files * Fixeds for DB recovery * Fix compilation * Fix compile errors * Fix formatting * Fix lint * Fix comments * Remove headerLoop * Properly terminate body download * Support for StatusData p2p proto * Fix forkid test * Fix test * Fix lint Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
34 lines
869 B
Go
34 lines
869 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(
|
|
common.Hash{}, /* initialHash */
|
|
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]headerdownload.HeaderRecord)); 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
|
|
}
|