Skip to content

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed
 

‎erigon-lib/downloader/downloader.go

+2-18
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,6 @@ func New(ctx context.Context, cfg *downloadercfg.Cfg, logger log.Logger, verbosi
330330
d.ctx, d.stopMainLoop = context.WithCancel(ctx)
331331

332332
if cfg.AddTorrentsFromDisk {
333-
var downloadMismatches []string
334-
335333
for _, download := range lock.Downloads {
336334
if info, err := d.torrentInfo(download.Name); err == nil {
337335
if info.Completed != nil {
@@ -357,29 +355,15 @@ func New(ctx context.Context, cfg *downloadercfg.Cfg, logger log.Logger, verbosi
357355
fileHash := hex.EncodeToString(fileHashBytes)
358356

359357
if fileHash != download.Hash && fileHash != hash {
360-
d.logger.Error("[snapshots] download db mismatch", "file", download.Name, "lock", download.Hash, "db", hash, "disk", fileHash, "downloaded", *info.Completed)
361-
downloadMismatches = append(downloadMismatches, download.Name)
358+
d.logger.Debug("[snapshots] download db mismatch", "file", download.Name, "lock", download.Hash, "db", hash, "disk", fileHash, "downloaded", *info.Completed)
362359
} else {
363-
d.logger.Warn("[snapshots] lock hash does not match completed download", "file", download.Name, "lock", hash, "download", download.Hash, "downloaded", *info.Completed)
360+
d.logger.Debug("[snapshots] lock hash does not match completed download", "file", download.Name, "lock", hash, "download", download.Hash, "downloaded", *info.Completed)
364361
}
365362
}
366363
}
367364
}
368365
}
369366

370-
if len(downloadMismatches) > 0 {
371-
return nil, fmt.Errorf("downloaded files have mismatched hashes: %s", strings.Join(downloadMismatches, ","))
372-
}
373-
374-
//TODO: why do we need it if we have `addTorrentFilesFromDisk`? what if they are conflict?
375-
//TODO: why it's before `BuildTorrentFilesIfNeed`? what if they are conflict?
376-
//TODO: even if hash is saved in "snapshots-lock.json" - it still must preserve `prohibit_new_downloads.lock` and don't download new files ("user restart" must be fast, "erigon3 has .kv files which never-ending merge and delete small files")
377-
//for _, it := range lock.Downloads {
378-
// if err := d.AddMagnetLink(ctx, snaptype.Hex2InfoHash(it.Hash), it.Name); err != nil {
379-
// return nil, err
380-
// }
381-
//}
382-
383367
if err := d.BuildTorrentFilesIfNeed(d.ctx, lock.Chain, lock.Downloads); err != nil {
384368
return nil, err
385369
}

0 commit comments

Comments
 (0)
Please sign in to comment.