aboutsummaryrefslogtreecommitdiffstats
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-10 16:56:00 +0300
committerYigit Sever2021-04-10 16:56:00 +0300
commit001a9ac21c29af53d31e9710d12e37d565880207 (patch)
tree7e0bbbc0b828694950ffaff6f6b51f63a62f46c7 /src/handlers.rs
parenta3bc90d6755acbe3670dfcf23f35acdaf9b00ffc (diff)
downloadgradecoin-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.rs9
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 @@
1use crate::auth::Pubkey;
1/// API handlers, the ends of each filter chain 2/// API handlers, the ends of each filter chain
2use log::debug; // this is more useful than debug! learn how to use this 3use log::debug; // this is more useful than debug! learn how to use this
3use parking_lot::RwLockUpgradableReadGuard; 4use parking_lot::RwLockUpgradableReadGuard;
4use std::convert::Infallible; 5use std::convert::Infallible;
5use warp::{http::StatusCode, reply}; 6use warp::filters::BoxedFilter;
6use warp::reject::Rejection; 7use warp::reject::Rejection;
7use crate::auth::Pubkey; 8use warp::{http::StatusCode, reply};
8 9
9use crate::schema::{Block, Db, Transaction}; 10use 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
65pub async fn propose_authenticated_transaction( 66pub 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