diff options
Diffstat (limited to 'src/routes.rs')
-rw-r--r-- | src/routes.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/routes.rs b/src/routes.rs index 871fd9c..b389919 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -8,7 +8,8 @@ use crate::schema::{Db, Transaction}; | |||
8 | /// Root, all routes combined | 8 | /// Root, all routes combined |
9 | pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { | 9 | pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { |
10 | transaction_list(db.clone()) | 10 | transaction_list(db.clone()) |
11 | .or(transaction_propose(db.clone())) | 11 | // .or(transaction_propose(db.clone())) |
12 | .or(authenticated_transaction_propose(db.clone())) | ||
12 | .or(block_propose(db.clone())) | 13 | .or(block_propose(db.clone())) |
13 | .or(block_list(db.clone())) | 14 | .or(block_list(db.clone())) |
14 | } | 15 | } |
@@ -51,16 +52,16 @@ pub fn authenticated_transaction_propose( | |||
51 | // // header/jwt logic to propose_transaction but that doesn't feel right either | 52 | // // header/jwt logic to propose_transaction but that doesn't feel right either |
52 | // // good luck <10-04-21, yigit> // | 53 | // // good luck <10-04-21, yigit> // |
53 | 54 | ||
55 | let db1 = db.clone(); | ||
54 | warp::path("transaction") | 56 | warp::path("transaction") |
55 | .and(warp::path::end()) | 57 | .and(warp::path::end()) |
56 | .and(warp::post()) | 58 | .and(warp::post()) |
57 | .and(custom_filters::transaction_json_body()) // returns transaction | 59 | .and(custom_filters::transaction_json_body()) // returns transaction |
58 | .map(|t: Transaction| { | 60 | .map(move |t: Transaction| { |
59 | // what do these do? | 61 | with_auth(db1.clone(), t).boxed() |
60 | with_auth(db.clone(), t) | ||
61 | }) | 62 | }) |
62 | .and(custom_filters::transaction_json_body()) // returns transaction | 63 | .and(custom_filters::transaction_json_body()) // returns transaction |
63 | .and(custom_filters::with_db(db)) // wraps db | 64 | .and(custom_filters::with_db(db.clone())) // wraps db |
64 | .and_then(handlers::propose_authenticated_transaction) // uses db, transaction and authenticated | 65 | .and_then(handlers::propose_authenticated_transaction) // uses db, transaction and authenticated |
65 | } | 66 | } |
66 | 67 | ||