From ed53fbc9097370feeda1c5507878933643a9bcc5 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sat, 10 Apr 2021 14:16:41 +0300 Subject: Trying to auth --- src/handlers.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/handlers.rs') 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( Ok(StatusCode::CREATED) } +/// POST /transaction, authenticated +/// The transaction arrived in this method has been authored by the public key in the source +pub async fn propose_authenticated_transaction( + pubkey: String, + new_transaction: Transaction, + db: Db, +) -> Result { + debug!("new transaction request {:?}", new_transaction); + + // let mut transactions = db.lock().await; + let mut transactions = db.pending_transactions.write(); + + transactions.insert(new_transaction.source.to_owned(), new_transaction); + + Ok(StatusCode::CREATED) +} + + /// POST /block /// Proposes a new block for the next round /// Can reject the block -- cgit v1.2.3-70-g09d2