diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/handlers.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index e63933d..88f9a80 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
| @@ -332,6 +332,7 @@ pub async fn authorized_propose_block( | |||
| 332 | db: Db, | 332 | db: Db, |
| 333 | ) -> Result<impl warp::Reply, warp::Rejection> { | 333 | ) -> Result<impl warp::Reply, warp::Rejection> { |
| 334 | debug!("POST request to /block, authorized_propose_block"); | 334 | debug!("POST request to /block, authorized_propose_block"); |
| 335 | println!("Hi"); | ||
| 335 | 336 | ||
| 336 | let users_store = db.users.upgradable_read(); | 337 | let users_store = db.users.upgradable_read(); |
| 337 | 338 | ||
| @@ -625,6 +626,17 @@ pub async fn authorized_propose_transaction( | |||
| 625 | debug!("clear for transaction proposal"); | 626 | debug!("clear for transaction proposal"); |
| 626 | 627 | ||
| 627 | let mut transactions = db.pending_transactions.write(); | 628 | let mut transactions = db.pending_transactions.write(); |
| 629 | |||
| 630 | if transactions.contains_key(&*new_transaction.source.to_owned()) { | ||
| 631 | return Ok(warp::reply::with_status( | ||
| 632 | warp::reply::json(&GradeCoinResponse { | ||
| 633 | res: ResponseType::Error, | ||
| 634 | message: "This user already has another pending transaction".to_owned(), | ||
| 635 | }), | ||
| 636 | StatusCode::BAD_REQUEST, | ||
| 637 | )); | ||
| 638 | } | ||
| 639 | |||
| 628 | transactions.insert(new_transaction.source.to_owned(), new_transaction); | 640 | transactions.insert(new_transaction.source.to_owned(), new_transaction); |
| 629 | Ok(warp::reply::with_status( | 641 | Ok(warp::reply::with_status( |
| 630 | warp::reply::json(&GradeCoinResponse { | 642 | warp::reply::json(&GradeCoinResponse { |
