From: Ramakrishnan Muthukrishnan Date: Fri, 24 Jul 2015 17:32:12 +0000 (+0530) Subject: bugfix: Hash string needs to be split into 20 bytes X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/index.php?a=commitdiff_plain;h=987a67d4964644362394f14079abd7920444ca5b;p=functorrent.git bugfix: Hash string needs to be split into 20 bytes Not the other way round (i.e. split by number of pieces, that' plain wrong). --- diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index 6209017..b193e43 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -76,7 +76,7 @@ mkPieceMap numPieces pieceHash pLengths = fromList kvs , hash = h , len = pLen }) | (i, h, pLen) <- zip3 [0..numPieces] hashes pLengths] - hashes = splitN (fromIntegral numPieces) pieceHash + hashes = splitN 20 pieceHash havePiece :: PieceMap -> Integer -> Bool havePiece pm index =