]> Sergey Matveev's repositories - btrtrc.git/commitdiff
GetRequestablePieces: remove runtime correctness check (#902)
authorOleg Guba <oleg.guba@gmail.com>
Fri, 9 Feb 2024 04:44:09 +0000 (20:44 -0800)
committerGitHub <noreply@github.com>
Fri, 9 Feb 2024 04:44:09 +0000 (15:44 +1100)
request-strategy/order.go

index e5c4792fefae3288b397cc6991cd3519be148036..eb4d1b7f7296b166bd4d704e00ca5c907381c0e6 100644 (file)
@@ -3,7 +3,6 @@ package requestStrategy
 import (
        "bytes"
 
-       g "github.com/anacrolix/generics"
        "github.com/anacrolix/multiless"
 
        "github.com/anacrolix/torrent/metainfo"
@@ -52,16 +51,7 @@ func GetRequestablePieces(
                storageLeft = &cap
        }
        var allTorrentsUnverifiedBytes int64
-       var lastItem g.Option[pieceRequestOrderItem]
        pro.tree.Scan(func(_i pieceRequestOrderItem) bool {
-               // Check that scan emits pieces in priority order.
-               if lastItem.Ok {
-                       if _i.Less(&lastItem.Value) {
-                               panic("scan not in order")
-                       }
-               }
-               lastItem.Set(_i)
-
                ih := _i.key.InfoHash
                var t Torrent = input.Torrent(ih)
                var piece Piece = t.Piece(_i.key.Index)