aboutsummaryrefslogtreecommitdiffstats
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-10 14:16:41 +0300
committerYigit Sever2021-04-10 14:16:41 +0300
commited53fbc9097370feeda1c5507878933643a9bcc5 (patch)
tree9fbb1ccf6baa2cec3a489c5f29bad12b97853420 /src/handlers.rs
parent93950532fa1b4e2512275ef607b3e5de13db3f2b (diff)
downloadgradecoin-ed53fbc9097370feeda1c5507878933643a9bcc5.tar.gz
gradecoin-ed53fbc9097370feeda1c5507878933643a9bcc5.tar.bz2
gradecoin-ed53fbc9097370feeda1c5507878933643a9bcc5.zip
Trying to auth
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index 856970d..256e72a 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -58,6 +58,24 @@ pub async fn propose_transaction(
58 Ok(StatusCode::CREATED) 58 Ok(StatusCode::CREATED)
59} 59}
60 60
61/// POST /transaction, authenticated
62/// The transaction arrived in this method has been authored by the public key in the source
63pub async fn propose_authenticated_transaction(
64 pubkey: String,
65 new_transaction: Transaction,
66 db: Db,
67) -> Result<impl warp::Reply, warp::Rejection> {
68 debug!("new transaction request {:?}", new_transaction);
69
70 // let mut transactions = db.lock().await;
71 let mut transactions = db.pending_transactions.write();
72
73 transactions.insert(new_transaction.source.to_owned(), new_transaction);
74
75 Ok(StatusCode::CREATED)
76}
77
78
61/// POST /block 79/// POST /block
62/// Proposes a new block for the next round 80/// Proposes a new block for the next round
63/// Can reject the block 81/// Can reject the block