From: Matt Joiner <anacrolix@gmail.com>
Date: Thu, 13 Jan 2022 03:04:54 +0000 (+1100)
Subject: Forget smart ban blocks after piece passes hash check
X-Git-Tag: v1.42.0~8^2^2~13
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9e5dac951421943c88134716b6eb8c980e4d9dc9;p=btrtrc.git

Forget smart ban blocks after piece passes hash check
---

diff --git a/torrent.go b/torrent.go
index 688ca3f8..078dca22 100644
--- a/torrent.go
+++ b/torrent.go
@@ -2169,6 +2169,9 @@ func (t *Torrent) pieceHasher(index pieceIndex) {
 			log.Printf("smart banned %v for piece %v", peer, index)
 		}
 		t.dropBannedPeers()
+		for ri := t.pieceRequestIndexOffset(index); ri < t.pieceRequestIndexOffset(index+1); ri++ {
+			t.smartBanCache.ForgetBlock(ri)
+		}
 	}
 	p.hashing = false
 	t.pieceHashed(index, correct, copyErr)