Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge e2 #10170

Closed
wants to merge 8 commits into from
9 changes: 9 additions & 0 deletions erigon-lib/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,15 @@ func (d *Downloader) mainLoop(silent bool) error {
if err := d.addTorrentFilesFromDisk(true); err != nil && !errors.Is(err, context.Canceled) {
d.logger.Warn("[snapshots] addTorrentFilesFromDisk", "err", err)
}

d.lock.Lock()
defer d.lock.Unlock()

for _, t := range d.torrentClient.Torrents() {
if urls, ok := d.webseeds.ByFileName(t.Name()); ok {
t.AddWebSeeds(urls)
}
}
}()
}

Expand Down
9 changes: 4 additions & 5 deletions erigon-lib/downloader/webseed.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ type WebSeeds struct {
torrentUrls snaptype.TorrentUrls // HTTP urls of .torrent files
downloadTorrentFile bool
torrentsWhitelist snapcfg.Preverified

seeds []*url.URL
seeds []*url.URL

logger log.Logger
verbosity log.Lvl
Expand Down Expand Up @@ -97,10 +96,10 @@ func (d *WebSeeds) getWebDownloadInfo(ctx context.Context, t *torrent.Torrent) (
return infos, seedHashMismatches, nil
}

func (d *WebSeeds) SetTorrent(t *AtomicTorrentFS, whiteList snapcfg.Preverified, downloadTorrentFile bool) {
func (d *WebSeeds) SetTorrent(torrentFS *AtomicTorrentFS, whiteList snapcfg.Preverified, downloadTorrentFile bool) {
d.downloadTorrentFile = downloadTorrentFile
d.torrentsWhitelist = whiteList
d.torrentFiles = t
d.torrentFiles = torrentFS
}

func (d *WebSeeds) checkHasTorrents(manifestResponse snaptype.WebSeedsFromProvider, report *WebSeedCheckReport) {
Expand Down Expand Up @@ -405,8 +404,8 @@ func (d *WebSeeds) makeWebSeedUrls(listsOfFiles []snaptype.WebSeedsFromProvider,
}

d.lock.Lock()
defer d.lock.Unlock()
d.byFileName = webSeedUrls
d.lock.Unlock()
}

func (d *WebSeeds) TorrentUrls() snaptype.TorrentUrls {
Expand Down
2 changes: 0 additions & 2 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ import (
"github.com/ledgerwatch/erigon/rpc"
)

//const HistoryV3AggregationStep = 1_562_500 / 10 // use this to reduce step size for dev/debug

// BorDefaultMinerGasPrice defines the minimum gas price for bor validators to mine a transaction.
var BorDefaultMinerGasPrice = big.NewInt(30 * params.GWei)

Expand Down
Loading