From 950200ac24d84a1509b28388be94836ff188c4c9 Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Thu, 5 Sep 2024 02:44:19 +0100 Subject: [PATCH] downloader: fix verify stop in incomplete file (#11874) Should fix #11748 and #11670 --------- Co-authored-by: Mark Holt --- erigon-lib/downloader/util.go | 6 ++++-- erigon-lib/go.mod | 2 +- erigon-lib/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/erigon-lib/downloader/util.go b/erigon-lib/downloader/util.go index 82cb590772c..e47655fecab 100644 --- a/erigon-lib/downloader/util.go +++ b/erigon-lib/downloader/util.go @@ -515,8 +515,10 @@ func ScheduleVerifyFile(ctx context.Context, t *torrent.Torrent, completePieces return fmt.Errorf("piece %s:%d verify failed: %w", t.Name(), change.Index, err) } - if change.Complete && !(change.Checking || change.Hashing || change.QueuedForHash || change.Marking) { - completePieces.Add(1) + if !(change.Checking || change.Hashing || change.QueuedForHash || change.Marking) { + if change.Complete { + completePieces.Add(1) + } delete(inprogress, change.Index) } diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index 5cf6bf55f52..92f2f7c1275 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -151,7 +151,7 @@ require ( ) replace ( - github.com/anacrolix/torrent => github.com/erigontech/torrent v1.54.2-alpha-37 + github.com/anacrolix/torrent => github.com/erigontech/torrent v1.54.2-alpha-38 github.com/holiman/bloomfilter/v2 => github.com/AskAlexSharov/bloomfilter/v2 v2.0.8 github.com/tidwall/btree => github.com/AskAlexSharov/btree v1.6.2 ) diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index 49d2ac956c8..7108fcf838b 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -156,8 +156,8 @@ github.com/erigontech/secp256k1 v1.1.0 h1:mO3YJMUSoASE15Ya//SoHiisptUhdXExuMUN1M github.com/erigontech/secp256k1 v1.1.0/go.mod h1:GokhPepsMB+EYDs7I5JZCprxHW6+yfOcJKaKtoZ+Fls= github.com/erigontech/speedtest v0.0.2 h1:W9Cvky/8AMUtUONwkLA/dZjeQ2XfkBdYfJzvhMZUO+U= github.com/erigontech/speedtest v0.0.2/go.mod h1:vulsRNiM51BmSTbVtch4FWxKxx53pS2D35lZTtao0bw= -github.com/erigontech/torrent v1.54.2-alpha-37 h1:vGe0MvnQJyhYbfSv1mBthPkoxLtcHpYU2zWLkAR1nxE= -github.com/erigontech/torrent v1.54.2-alpha-37/go.mod h1:QtK2WLdEz1Iy1Dh/325UltdHU0nA1xujh2rN6aov6y0= +github.com/erigontech/torrent v1.54.2-alpha-38 h1:0KQTLlotAWy63MuyUatAzvIYwULYMSHI51A8Jl+3TC4= +github.com/erigontech/torrent v1.54.2-alpha-38/go.mod h1:QtK2WLdEz1Iy1Dh/325UltdHU0nA1xujh2rN6aov6y0= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/frankban/quicktest v1.9.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= diff --git a/go.mod b/go.mod index 1f8cab8111c..7842fb1a7d0 100644 --- a/go.mod +++ b/go.mod @@ -289,6 +289,6 @@ require ( ) replace ( - github.com/anacrolix/torrent => github.com/erigontech/torrent v1.54.2-alpha-37 + github.com/anacrolix/torrent => github.com/erigontech/torrent v1.54.2-alpha-38 github.com/holiman/bloomfilter/v2 => github.com/AskAlexSharov/bloomfilter/v2 v2.0.8 ) diff --git a/go.sum b/go.sum index f1303c4a13d..6ce826b5cc5 100644 --- a/go.sum +++ b/go.sum @@ -280,8 +280,8 @@ github.com/erigontech/silkworm-go v0.18.0 h1:j56p61xZHBFhZGH1OixlGU8KcfjHzcw9pjA github.com/erigontech/silkworm-go v0.18.0/go.mod h1:O50ux0apICEVEGyRWiE488K8qz8lc3PA/SXbQQAc8SU= github.com/erigontech/speedtest v0.0.2 h1:W9Cvky/8AMUtUONwkLA/dZjeQ2XfkBdYfJzvhMZUO+U= github.com/erigontech/speedtest v0.0.2/go.mod h1:vulsRNiM51BmSTbVtch4FWxKxx53pS2D35lZTtao0bw= -github.com/erigontech/torrent v1.54.2-alpha-37 h1:vGe0MvnQJyhYbfSv1mBthPkoxLtcHpYU2zWLkAR1nxE= -github.com/erigontech/torrent v1.54.2-alpha-37/go.mod h1:QtK2WLdEz1Iy1Dh/325UltdHU0nA1xujh2rN6aov6y0= +github.com/erigontech/torrent v1.54.2-alpha-38 h1:0KQTLlotAWy63MuyUatAzvIYwULYMSHI51A8Jl+3TC4= +github.com/erigontech/torrent v1.54.2-alpha-38/go.mod h1:QtK2WLdEz1Iy1Dh/325UltdHU0nA1xujh2rN6aov6y0= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c h1:CndMRAH4JIwxbW8KYq6Q+cGWcGHz0FjGR3QqcInWcW0=