Skip to content

Commit

Permalink
downloader: fix verify stop in incomplete file (#11874)
Browse files Browse the repository at this point in the history
Should fix #11748 and #11670

---------

Co-authored-by: Mark Holt <[email protected]>
  • Loading branch information
dvovk and mh0lt authored Sep 5, 2024
1 parent e138dab commit 950200a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions erigon-lib/downloader/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
4 changes: 2 additions & 2 deletions erigon-lib/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 950200a

Please sign in to comment.