diff options
author | Yigit Sever | 2021-04-10 16:56:00 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-10 16:56:00 +0300 |
commit | 001a9ac21c29af53d31e9710d12e37d565880207 (patch) | |
tree | 7e0bbbc0b828694950ffaff6f6b51f63a62f46c7 /src/handlers.rs | |
parent | a3bc90d6755acbe3670dfcf23f35acdaf9b00ffc (diff) | |
download | gradecoin-001a9ac21c29af53d31e9710d12e37d565880207.tar.gz gradecoin-001a9ac21c29af53d31e9710d12e37d565880207.tar.bz2 gradecoin-001a9ac21c29af53d31e9710d12e37d565880207.zip |
giving up with style
Diffstat (limited to 'src/handlers.rs')
-rw-r--r-- | src/handlers.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index 0bcbd49..a9c0315 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
@@ -1,10 +1,11 @@ | |||
1 | use crate::auth::Pubkey; | ||
1 | /// API handlers, the ends of each filter chain | 2 | /// API handlers, the ends of each filter chain |
2 | use log::debug; // this is more useful than debug! learn how to use this | 3 | use log::debug; // this is more useful than debug! learn how to use this |
3 | use parking_lot::RwLockUpgradableReadGuard; | 4 | use parking_lot::RwLockUpgradableReadGuard; |
4 | use std::convert::Infallible; | 5 | use std::convert::Infallible; |
5 | use warp::{http::StatusCode, reply}; | 6 | use warp::filters::BoxedFilter; |
6 | use warp::reject::Rejection; | 7 | use warp::reject::Rejection; |
7 | use crate::auth::Pubkey; | 8 | use warp::{http::StatusCode, reply}; |
8 | 9 | ||
9 | use crate::schema::{Block, Db, Transaction}; | 10 | use crate::schema::{Block, Db, Transaction}; |
10 | 11 | ||
@@ -63,11 +64,10 @@ pub async fn propose_transaction( | |||
63 | /// POST /transaction, authenticated | 64 | /// POST /transaction, authenticated |
64 | /// The transaction arrived in this method has been authored by the public key in the source | 65 | /// The transaction arrived in this method has been authored by the public key in the source |
65 | pub async fn propose_authenticated_transaction( | 66 | pub async fn propose_authenticated_transaction( |
66 | pubkey: Pubkey, | 67 | pubkey: BoxedFilter<(Pubkey,)>, |
67 | new_transaction: Transaction, | 68 | new_transaction: Transaction, |
68 | db: Db, | 69 | db: Db, |
69 | ) -> Result<impl warp::Reply, warp::Rejection> { | 70 | ) -> Result<impl warp::Reply, warp::Rejection> { |
70 | |||
71 | // auth logic | 71 | // auth logic |
72 | debug!("new transaction request {:?}", new_transaction); | 72 | debug!("new transaction request {:?}", new_transaction); |
73 | 73 | ||
@@ -79,7 +79,6 @@ pub async fn propose_authenticated_transaction( | |||
79 | Ok(StatusCode::CREATED) | 79 | Ok(StatusCode::CREATED) |
80 | } | 80 | } |
81 | 81 | ||
82 | |||
83 | /// POST /block | 82 | /// POST /block |
84 | /// Proposes a new block for the next round | 83 | /// Proposes a new block for the next round |
85 | /// Can reject the block | 84 | /// Can reject the block |