From 987a67d4964644362394f14079abd7920444ca5b Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Fri, 24 Jul 2015 23:02:12 +0530 Subject: [PATCH] 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). --- src/FuncTorrent/Peer.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = -- 2.37.2