diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2019-05-09 21:59:26 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2019-05-09 21:59:26 +0200 |
commit | 779c6fbd4d73b718ea64f22114f1d12463479d67 (patch) | |
tree | 3daca4b385466f77636eccd89c3d3da8dc3bcf2a | |
parent | c6b4149a73d71e1b86575bae9c2615a2296c3091 (diff) |
Storage: fix loop error in zeroRef implementation
-rw-r--r-- | src/Storage.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Storage.hs b/src/Storage.hs index a306206..25c7a75 100644 --- a/src/Storage.hs +++ b/src/Storage.hs @@ -116,9 +116,11 @@ instance BA.ByteArrayAccess Ref where zeroRef :: Storage -> Ref zeroRef s = Ref s h - where h = case digestFromByteString $ B.replicate (BA.length h) 0 of + where h = case digestFromByteString $ B.replicate (hashDigestSize $ digestAlgo h) 0 of Nothing -> error $ "Failed to create zero hash" Just h' -> h' + digestAlgo :: Digest a -> a + digestAlgo = undefined isZeroRef :: Ref -> Bool isZeroRef (Ref _ h) = all (==0) $ BA.unpack h |