From 44d21b676f90a2fc8b255eb9c1393e53f40c9daa Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 12 Apr 2021 05:32:53 +0300 Subject: Implement proof-of-work Using blacke2s: https://docs.rs/blake2/0.9.1/blake2/ Using this guy's hash checker https://gist.github.com/gkbrk/2e4835e3a17b3fb6e1e7 blacke2s with 5 bits 0 can mine a block between 20 seconds to 359 during my tests, hope it'll be fun --- src/custom_filters.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/custom_filters.rs') diff --git a/src/custom_filters.rs b/src/custom_filters.rs index 0806c6d..315ba4a 100644 --- a/src/custom_filters.rs +++ b/src/custom_filters.rs @@ -1,10 +1,7 @@ -// Common filters ment to be shared between many endpoints - +use gradecoin::schema::{AuthRequest, Block, Db, Transaction}; use std::convert::Infallible; use warp::{Filter, Rejection}; -use crate::schema::{Block, Db, Transaction, AuthRequest}; - // Database context for routes pub fn with_db(db: Db) -> impl Filter + Clone { warp::any().map(move || db.clone()) @@ -12,7 +9,8 @@ pub fn with_db(db: Db) -> impl Filter + Clo // Accept only json encoded User body and reject big payloads // TODO: find a good limit for this, (=e2482057; 8 char String + rsa pem) <11-04-21, yigit> // -pub fn auth_request_json_body() -> impl Filter + Clone { +pub fn auth_request_json_body() -> impl Filter + Clone +{ warp::body::content_length_limit(1024 * 32).and(warp::body::json()) } -- cgit v1.2.3-70-g09d2