Skip to content

Fix a collection of downloader, snapshot sync and torrent related issues #15043

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

Merged
merged 99 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
f368d69
Tidy comment
anacrolix Apr 7, 2025
d4c329f
Add description for bt-search snapshot command
anacrolix Apr 7, 2025
7de19f3
Upstream anacrolix/torrent compatibility
anacrolix Apr 11, 2025
d4e750b
Expose /downloaderTorrentClientStatus for regular erigon sync
anacrolix Apr 14, 2025
b476b89
Remove downloader manifest driven sync
anacrolix Apr 17, 2025
eee54eb
Switch to anacrolix/torrent upstream
anacrolix Apr 23, 2025
3ea46dd
Remove old handler
anacrolix Apr 23, 2025
f5966a0
Makefile: Add BUILD_FLAGS for -race
anacrolix Apr 24, 2025
08ced5a
Downloader refactoring
anacrolix Apr 24, 2025
e5670f5
Begin using part files
anacrolix Apr 28, 2025
c57a89f
Merge branch 'main' into anacrolix/main
anacrolix Apr 29, 2025
3862254
Logging and part files
anacrolix Apr 30, 2025
89515cc
Don't load unrelated chains
anacrolix May 6, 2025
63c3d60
Fix the returned error
anacrolix May 6, 2025
c2c0eb5
Merge branch 'anacrolix/custom-snapshot-config' into anacrolix/main
anacrolix May 6, 2025
b5d0d0d
Fix not returning first parsed webseeds
anacrolix May 6, 2025
c35eddf
A few fixes loading metainfos from disk
anacrolix May 7, 2025
10ff9db
Remove a few unused things
anacrolix May 7, 2025
54a561a
Harden AtomicTorrentFS even more
anacrolix May 7, 2025
168598a
Remove broken trackers
anacrolix May 7, 2025
c12ddd0
Truncate oversize snapshot files
anacrolix May 7, 2025
4029982
Remove Downloader.Verify and TorrentCompleted
anacrolix May 7, 2025
fdb4980
Remove bad metainfos from disk, do onGotInfo actions synchronously if…
anacrolix May 9, 2025
baf0803
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 9, 2025
c7f5294
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 9, 2025
6ea3817
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 13, 2025
a370f9f
Disable the panic catching
anacrolix May 13, 2025
d495b1a
Revert "Don't load unrelated chains"
anacrolix May 13, 2025
89226f0
Modify GO_FLAGS to allow clobbering trimpath
anacrolix May 15, 2025
2b89b7f
Zed removed trailing whitespace
anacrolix May 15, 2025
633d84c
Add missing record attrs in slog to turbo log adapter
anacrolix May 15, 2025
5330a8b
Fix error log level conversion due to integer truncation
anacrolix May 15, 2025
911acc4
Improve slog to erilog mapping
anacrolix May 16, 2025
22e1009
Ignore datadirs
anacrolix May 16, 2025
faa0206
Resolve local go work deps
anacrolix May 16, 2025
bbfc7bf
Add note about torrent rate flags
anacrolix May 16, 2025
b8c21fb
Pass safer burst values to torrent config rates
anacrolix May 16, 2025
690ef6b
Set chunk size to 256 KiB
anacrolix May 16, 2025
9e3a377
Disjoint header files in stage sync
anacrolix May 16, 2025
497ed53
Introduce downloadercfg.NewCfgOpts so I can get torrent disable track…
anacrolix May 20, 2025
597435b
Rejigger some Makefile vars so I can cross compile out of tree
anacrolix May 20, 2025
5a863b6
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 20, 2025
e4923ba
Move verify to Downloader config
anacrolix May 21, 2025
c8eedb7
Make %.cmd phony
anacrolix May 21, 2025
aed7904
I really need that output...
anacrolix May 21, 2025
64215ce
Verify pieces in files that don't pass completed snapshot validation
anacrolix May 21, 2025
2c14690
Prefer Slogger to anacrolix/torrent now
anacrolix May 21, 2025
e43ecf6
Save metainfo files only when torrent newly completes
anacrolix May 21, 2025
238d463
Tidy up progress logging
anacrolix May 21, 2025
3add853
Write preverified after download stage completes
anacrolix May 21, 2025
e590279
Forgot to link up Verify and VerifyTorrentData fields
anacrolix May 22, 2025
84562a0
Log panics
anacrolix May 22, 2025
64c2a0c
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 22, 2025
6a0af69
Change disk metainfo hash mismatch to debug
anacrolix May 26, 2025
cb6a7fc
Use slog to log torrent stuff, and add a separate log file
anacrolix May 26, 2025
81749da
Print stack from panic in StageLoopIteration
anacrolix May 26, 2025
1d0aeea
Fix up various test build errors
anacrolix May 26, 2025
1888e43
Merge branch 'main' into anacrolix/master
anacrolix May 27, 2025
b2ae52a
Fix imports for failed CI
anacrolix May 27, 2025
4dd2c14
Improve downloader logging
anacrolix May 27, 2025
75d4e6b
Log completed snapshot sync steps
anacrolix May 27, 2025
6548719
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 27, 2025
161585b
Fix some assumptions for tests
anacrolix May 28, 2025
5e4a0b9
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 28, 2025
d93a674
go mod tidy all modules
anacrolix May 28, 2025
fe6432a
Merge branch 'main' into anacrolix/master
anacrolix May 28, 2025
e5ec9fc
Unused func
anacrolix May 28, 2025
168e978
Remove unused flags and config fields
anacrolix May 28, 2025
487529a
Restore loading torrents from disk
anacrolix May 28, 2025
39dc8ab
Fix locks for required torrents
anacrolix May 29, 2025
561b8ba
Log adapter testing logs
anacrolix May 29, 2025
ac61d00
Fix integer overflow in time left calculation
anacrolix May 29, 2025
e8baacd
Retry saving metainfo for new torrent if final precheck fails
anacrolix May 29, 2025
c18bc34
Update anacrolix/torrent
anacrolix May 29, 2025
91894c4
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix May 30, 2025
9bf1528
Fix downloader ignoring cancellation when there are incomplete torrents
anacrolix May 30, 2025
616b874
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix Jun 2, 2025
ba2ada7
Reinstate torrent.download.slots until I can deprecate it
anacrolix Jun 2, 2025
b804734
Fix lints
anacrolix Jun 2, 2025
6278d39
Add commit option for mod tidy check
anacrolix Jun 4, 2025
076678c
Make Go expvars available to Prometheus for diagnostics
anacrolix Jun 4, 2025
2196bb2
Sync deps and lint
anacrolix Jun 4, 2025
e22615e
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix Jun 4, 2025
b63d866
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix Jun 6, 2025
963afdd
Add TODO on logging
anacrolix Jun 6, 2025
7de6ff2
Merge remote-tracking branch 'origin/main' into anacrolix/main
anacrolix Jun 10, 2025
097ece7
Fix torrent_cat always showing empty InfoBytes
anacrolix Jun 10, 2025
e77b404
Fix up Downloader verify to fail on incomplete
anacrolix Jun 13, 2025
b9ab5ca
Improve error message while messing with snapshot dir
anacrolix Jun 13, 2025
27c1914
Checked path calculation in AddTorrentsFromDisk
anacrolix Jun 13, 2025
1088519
Merge branch 'main' into anacrolix/master
anacrolix Jun 13, 2025
4c01e95
Tighten up Downloader snapshot deletion
anacrolix Jun 16, 2025
e3e9364
Fix anacrolix/torrent webseed.Client.Logger not being set for content…
anacrolix Jun 16, 2025
2634b79
Merge branch 'main' into anacrolix/master
anacrolix Jun 16, 2025
adb7320
Remove anacrolix/torrent replace directives that have crept in
anacrolix Jun 17, 2025
0636991
Break the weird deadlock go mod tidy is in with all the modules
anacrolix Jun 17, 2025
d23c8c4
Lint changes go1.23 to go1.24
anacrolix Jun 18, 2025
6f3257f
Merge remote-tracking branch 'origin/main' into anacrolix/master
anacrolix Jun 19, 2025
1660c1c
kick ci
AskAlexSharov Jun 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,11 @@ node_modules
/config.yaml
/config.yml

vendor
vendor/

!/cmd/snapshots
**/snapshots/
mdbx.dat
mdbx.lck
/*/**/LOCK
/*/**/nodekey
47 changes: 27 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GO ?= go # if using docker, should not need to be installed/linked
GOAMD64_VERSION ?= v2 # See https://go.dev/wiki/MinimumRequirements#microarchitecture-support
GOBINREL = build/bin
GOBIN = $(CURDIR)/$(GOBINREL)
UNAME = $(shell uname) # Supported: Darwin, Linux
GOBINREL := build/bin
GOBIN := $(CURDIR)/$(GOBINREL)
UNAME := $(shell uname) # Supported: Darwin, Linux
DOCKER := $(shell command -v docker 2> /dev/null)

GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
Expand Down Expand Up @@ -46,7 +46,7 @@ ifeq ($(shell uname -s), Darwin)
endif

# about netgo see: https://github.com/golang/go/issues/30310#issuecomment-471669125 and https://github.com/golang/go/issues/57757
BUILD_TAGS = nosqlite,noboltdb
BUILD_TAGS = noboltdb

ifneq ($(shell "$(CURDIR)/turbo/silkworm/silkworm_compat_check.sh"),)
BUILD_TAGS := $(BUILD_TAGS),nosilkworm
Expand All @@ -58,12 +58,17 @@ GOPRIVATE = github.com/erigontech/silkworm-go

PACKAGE = github.com/erigontech/erigon

override GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
override GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"
# Add to user provided GO_FLAGS. Insert it after a bunch of other stuff to allow overrides, and before tags to maintain BUILD_TAGS (set that instead if you want to modify it).

GOBUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS)
GO_DBG_BUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs
GOTEST = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./...
GO_RELEASE_FLAGS := -trimpath -buildvcs=false \
-ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"
GO_BUILD_ENV = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)"

# Basic release build. Pass EXTRA_BUILD_TAGS if you want to modify the tags set.
GOBUILD = $(GO_BUILD_ENV) $(GO) build $(GO_RELEASE_FLAGS) $(GO_FLAGS) -tags $(BUILD_TAGS)
DLV_GO_FLAGS := -gcflags='all="-N -l" -trimpath=false'
GO_BUILD_DEBUG = $(GO_BUILD_ENV) CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" $(GO) build $(DLV_GO_FLAGS) $(GO_FLAGS) -tags $(BUILD_TAGS),debug
GOTEST = $(GO_BUILD_ENV) GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./...

default: all

Expand Down Expand Up @@ -117,12 +122,14 @@ docker-compose: validate_docker_build_args setup_xdg_data_home

## dbg debug build allows see C stack traces, run it with GOTRACEBACK=crash. You don't need debug build for C pit for profiling. To profile C code use SETCGOTRCKEBACK=1
dbg:
$(GO_DBG_BUILD) -o $(GOBIN)/ ./cmd/...
$(GO_BUILD_DEBUG) -o $(GOBIN)/ ./cmd/...

.PHONY: %.cmd
# Deferred (=) because $* isn't defined until the rule is executed.
%.cmd: override OUTPUT = $(GOBIN)/$*$(CMD_BUILD_SUFFIX)
%.cmd:
@# Note: $* is replaced by the command name
@echo "Building $*"
@cd ./cmd/$* && $(GOBUILD) -o $(GOBIN)/$*
@echo Building '$(OUTPUT)'
cd ./cmd/$* && $(GOBUILD) -o $(OUTPUT)
@echo "Run \"$(GOBIN)/$*\" to launch $*."

## geth: run erigon (TODO: remove?)
Expand Down Expand Up @@ -226,7 +233,7 @@ test-all-race: test-erigon-lib-all-race test-erigon-db-all-race test-p2p-all-rac
}

## test-hive run the hive tests locally off nektos/act workflows simulator
test-hive:
test-hive:
@if ! command -v act >/dev/null 2>&1; then \
echo "act command not found in PATH, please source it in PATH. If nektosact is not installed, install it by visiting https://nektosact.com/installation/index.html"; \
elif [ -z "$(GITHUB_TOKEN)"]; then \
Expand Down Expand Up @@ -285,7 +292,7 @@ hive-local:

eest-hive:
@if [ ! -d "temp" ]; then mkdir temp; fi
docker build -t "test/erigon:$(SHORT_COMMIT)" .
docker build -t "test/erigon:$(SHORT_COMMIT)" .
rm -rf "temp/eest-hive-$(SHORT_COMMIT)" && mkdir "temp/eest-hive-$(SHORT_COMMIT)"
cd "temp/eest-hive-$(SHORT_COMMIT)" && git clone https://github.com/erigontech/hive
cd "temp/eest-hive-$(SHORT_COMMIT)/hive" && \
Expand Down Expand Up @@ -316,7 +323,7 @@ check-kurtosis:
kurtosis-pectra-assertoor: check-kurtosis
@$(call run-kurtosis-assertoor,".github/workflows/kurtosis/pectra.io")

kurtosis-regular-assertoor: check-kurtosis
kurtosis-regular-assertoor: check-kurtosis
@$(call run-kurtosis-assertoor,".github/workflows/kurtosis/regular-assertoor.io")

kurtosis-fusaka-assertoor: check-kurtosis
Expand Down Expand Up @@ -347,10 +354,10 @@ lint:

## tidy: `go mod tidy`
tidy:
@cd erigon-lib && go mod tidy
@cd erigon-db && go mod tidy
@cd p2p && go mod tidy
@go mod tidy
cd erigon-lib && go mod tidy
cd erigon-db && go mod tidy
cd p2p && go mod tidy
go mod tidy

## clean: cleans the go cache, build dir, libmdbx db dir
clean:
Expand Down
87 changes: 63 additions & 24 deletions cmd/downloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import (
"net/url"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"time"

"github.com/anacrolix/torrent/metainfo"
"github.com/c2h5oh/datasize"
"github.com/go-viper/mapstructure/v2"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
"github.com/pelletier/go-toml/v2"
Expand Down Expand Up @@ -60,11 +62,11 @@ import (
"github.com/erigontech/erigon/cmd/hack/tool"
"github.com/erigontech/erigon/cmd/utils"
"github.com/erigontech/erigon/params"
_ "github.com/erigontech/erigon/polygon/heimdall" //hack
"github.com/erigontech/erigon/turbo/debug"
"github.com/erigontech/erigon/turbo/logging"

_ "github.com/erigontech/erigon-db/snaptype" //hack
_ "github.com/erigontech/erigon/polygon/heimdall" //hack
_ "github.com/erigontech/erigon-db/snaptype" //hack
)

func main() {
Expand All @@ -90,17 +92,18 @@ var (
natSetting string
torrentVerbosity int
downloadRateStr, uploadRateStr string
torrentDownloadSlots int
staticPeersStr string
torrentPort int
torrentMaxPeers int
torrentConnsPerFile int
targetFile string
disableIPV6 bool
disableIPV4 bool
seedbox bool
dbWritemap bool
all bool
// How do I mark this deprecated with cobra?
torrentDownloadSlots int
staticPeersStr string
torrentPort int
torrentMaxPeers int
torrentConnsPerFile int
targetFile string
disableIPV6 bool
disableIPV4 bool
seedbox bool
dbWritemap bool
all bool
)

func init() {
Expand All @@ -118,6 +121,7 @@ func init() {
rootCmd.Flags().IntVar(&torrentPort, "torrent.port", utils.TorrentPortFlag.Value, utils.TorrentPortFlag.Usage)
rootCmd.Flags().IntVar(&torrentMaxPeers, "torrent.maxpeers", utils.TorrentMaxPeersFlag.Value, utils.TorrentMaxPeersFlag.Usage)
rootCmd.Flags().IntVar(&torrentConnsPerFile, "torrent.conns.perfile", utils.TorrentConnsPerFileFlag.Value, utils.TorrentConnsPerFileFlag.Usage)
// Deprecated.
rootCmd.Flags().IntVar(&torrentDownloadSlots, "torrent.download.slots", utils.TorrentDownloadSlotsFlag.Value, utils.TorrentDownloadSlotsFlag.Usage)
rootCmd.Flags().StringVar(&staticPeersStr, utils.TorrentStaticPeersFlag.Name, utils.TorrentStaticPeersFlag.Value, utils.TorrentStaticPeersFlag.Usage)
rootCmd.Flags().BoolVar(&disableIPV6, "downloader.disable.ipv6", utils.DisableIPV6.Value, utils.DisableIPV6.Usage)
Expand Down Expand Up @@ -216,7 +220,7 @@ func Downloader(ctx context.Context, logger log.Logger) error {
if err := checkChainName(ctx, dirs, chain); err != nil {
return err
}
torrentLogLevel, _, err := downloadercfg.Int2LogLevel(torrentVerbosity)
torrentLogLevel, err := downloadercfg.Int2LogLevel(torrentVerbosity)
if err != nil {
return err
}
Expand Down Expand Up @@ -244,12 +248,26 @@ func Downloader(ctx context.Context, logger log.Logger) error {
return err
}
}
cfg, err := downloadercfg.New(ctx, dirs, version, torrentLogLevel, downloadRate, uploadRate, torrentPort, torrentConnsPerFile, torrentDownloadSlots, staticPeers, webseedsList, chain, true, dbWritemap)
cfg, err := downloadercfg.New(
ctx,
dirs,
version,
torrentLogLevel,
downloadRate,
uploadRate,
torrentPort,
torrentConnsPerFile,
staticPeers,
webseedsList,
chain,
dbWritemap,
downloadercfg.NewCfgOpts{},
)
if err != nil {
return err
}

cfg.ClientConfig.PieceHashersPerTorrent = dbg.EnvInt("DL_HASHERS", 32)
cfg.ClientConfig.PieceHashersPerTorrent = dbg.EnvInt("DL_HASHERS", runtime.NumCPU())
Copy link
Collaborator

@AskAlexSharov AskAlexSharov May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my head hashers are not cpu-bouned: they are mmap-read-page-faults-bounded.
This is reason why it's not linked to NumCPU.
On server with much cpus and slow disks (cloud drives) - it can lead to golang's runtime panic - 10K threads exeeded (because this limit is per-file and we have many files).
Actually we need global limit for hashers amount - but let's do it in another (low-prio future) tasks.
We currently don't focus much on cloud drives (or another slow drives) - many other existing bottelnecks need to fix first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I was curious as to the value and knew there'd a good reason.

cfg.ClientConfig.DisableIPv6 = disableIPV6
cfg.ClientConfig.DisableIPv4 = disableIPV4

Expand All @@ -259,9 +277,12 @@ func Downloader(ctx context.Context, logger log.Logger) error {
}
downloadernat.DoNat(natif, cfg.ClientConfig, logger)

cfg.AddTorrentsFromDisk = true // always true unless using uploader - which wants control of torrent files
// Called manually to ensure all torrents are present before verification.
cfg.AddTorrentsFromDisk = false
manualDataVerification := verify || verifyFailfast || len(verifyFiles) > 0
cfg.ManualDataVerification = manualDataVerification

d, err := downloader.New(ctx, cfg, logger, log.LvlInfo, seedbox)
d, err := downloader.New(ctx, cfg, logger, log.LvlInfo)
if err != nil {
return err
}
Expand All @@ -270,15 +291,28 @@ func Downloader(ctx context.Context, logger log.Logger) error {

d.HandleTorrentClientStatus()

err = d.AddTorrentsFromDisk(ctx)
if err != nil {
return fmt.Errorf("adding torrents from disk: %w", err)
}

// I think we could use DisableInitialPieceVerification to get the behaviour we want here: One
// hash, and fail if it's in the verify files list or we have fail fast on.

if len(_verifyFiles) > 0 {
verifyFiles = strings.Split(_verifyFiles, ",")
}
if verify || verifyFailfast || len(verifyFiles) > 0 { // remove and create .torrent files (will re-read all snapshots)
if err = d.VerifyData(ctx, verifyFiles, verifyFailfast); err != nil {
if manualDataVerification { // remove and create .torrent files (will re-read all snapshots)
if err = d.VerifyData(ctx, verifyFiles); err != nil {
return err
}
}

// This only works if Cfg.ManualDataVerification is held by reference by the Downloader. The
// alternative is to pass the value through AddTorrentsFromDisk, do it per Torrent ourselves, or
// defer all hashing to the torrent Client in the Downloader and wait for it to complete.
cfg.ManualDataVerification = false

bittorrentServer, err := downloader.NewGrpcServer(d)
if err != nil {
return fmt.Errorf("new server: %w", err)
Expand Down Expand Up @@ -375,14 +409,19 @@ var torrentCat = &cobra.Command{
if err != nil {
return fmt.Errorf("LoadFromFile: %w, file=%s", err, fPath)
}
var ms map[string]any
err = mapstructure.Decode(mi, &ms)
if err != nil {
return fmt.Errorf("decoding metainfo into map: %w", err)
}
fmt.Printf("InfoHash = '%x'\n", mi.HashInfoBytes())
mi.InfoBytes = nil
bytes, err := toml.Marshal(mi)
delete(ms, "InfoBytes")
bytes, err := toml.Marshal(ms)
if err != nil {
return err
}
fmt.Printf("%s\n", string(bytes))
return nil
_, err = os.Stdout.Write(bytes)
return err
},
}
var torrentClean = &cobra.Command{
Expand Down
19 changes: 9 additions & 10 deletions cmd/erigon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/urfave/cli/v2"

"github.com/erigontech/erigon-lib/common/datadir"
"github.com/erigontech/erigon-lib/common/dbg"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/metrics"
"github.com/erigontech/erigon-lib/version"
Expand All @@ -38,15 +37,15 @@ import (
)

func main() {
defer func() {
panicResult := recover()
if panicResult == nil {
return
}

log.Error("catch panic", "err", panicResult, "stack", dbg.Stack())
os.Exit(1)
}()
//defer func() {
// panicResult := recover()
// if panicResult == nil {
// return
// }
//
// log.Error("catch panic", "err", panicResult, "stack", dbg.Stack())
// os.Exit(1)
//}()

app := erigonapp.MakeApp("erigon", runErigon, erigoncli.DefaultFlags)
if err := app.Run(os.Args); err != nil {
Expand Down
Loading
Loading