diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-12 22:59:03 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-12 22:59:03 -0400 |
commit | e333a779338ff8bccdc4225fc953d6f4f0226db0 (patch) | |
tree | c07f1165ba101c2b10e914170fb07628e1d08d3a /HTTP/Server.hs | |
parent | 13c408d2295597540f0b2dfb6f7b86e739876c90 (diff) | |
download | keysafe-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.hs | 5 |
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 |