summaryrefslogtreecommitdiffhomepage
path: root/HTTP/Server.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-12 22:59:03 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-12 22:59:03 -0400
commite333a779338ff8bccdc4225fc953d6f4f0226db0 (patch)
treec07f1165ba101c2b10e914170fb07628e1d08d3a /HTTP/Server.hs
parent13c408d2295597540f0b2dfb6f7b86e739876c90 (diff)
downloadkeysafe-e333a779338ff8bccdc4225fc953d6f4f0226db0.tar.gz
add proof of work to countobjects
In this case, an empty string is hashed to generate the PoW.
Diffstat (limited to 'HTTP/Server.hs')
-rw-r--r--HTTP/Server.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/HTTP/Server.hs b/HTTP/Server.hs
index dd35d1c..65d3d32 100644
--- a/HTTP/Server.hs
+++ b/HTTP/Server.hs
@@ -85,8 +85,9 @@ validObjectsize o = any (sz ==) knownObjectSizes
where
sz = B.length (fromStorableObject o)
-countObjects :: ServerState -> Handler CountResult
-countObjects = liftIO . countShares . serverStorage
+countObjects :: ServerState -> Maybe ProofOfWork -> Handler (POWGuarded CountResult)
+countObjects st pow = rateLimit (rateLimiter st) pow NoPOWIdent $
+ liftIO $ countShares $ serverStorage st
-- | 1 is a dummy value; the server does not know the actual share numbers.
dummyShareNum :: ShareNum