aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2021-05-05 15:31:25 +0300
committerYigit Sever2021-05-05 15:31:25 +0300
commite7e4ec795b0975a82c3b4b96f8e8a93712f3d91a (patch)
tree4b14a6ef454a2eb16acb1a2bc242ddc9a60074e1
parent485df24a2ec454195f8be3834efe6be228b254a5 (diff)
downloadgradecoin-e7e4ec795b0975a82c3b4b96f8e8a93712f3d91a.tar.gz
gradecoin-e7e4ec795b0975a82c3b4b96f8e8a93712f3d91a.tar.bz2
gradecoin-e7e4ec795b0975a82c3b4b96f8e8a93712f3d91a.zip
Bot tx bugfix
-rw-r--r--src/handlers.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index 839443d..c7457c4 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -559,6 +559,8 @@ pub async fn propose_block(
559 coinbase_user.balance += BLOCK_REWARD; 559 coinbase_user.balance += BLOCK_REWARD;
560 } 560 }
561 561
562 let holding: HashMap<String, Transaction> = HashMap::new();
563
562 // Play out the transactions 564 // Play out the transactions
563 for fingerprint in new_block.transaction_list.iter() { 565 for fingerprint in new_block.transaction_list.iter() {
564 if let Some(transaction) = pending_transactions.remove(fingerprint) { 566 if let Some(transaction) = pending_transactions.remove(fingerprint) {
@@ -590,6 +592,10 @@ pub async fn propose_block(
590 } 592 }
591 } 593 }
592 594
595 for (fp, tx) in holding.iter() {
596 pending_transactions.insert(fp.to_owned(), tx.to_owned());
597 }
598
593 // just update everyone's .guy file 599 // just update everyone's .guy file
594 for (fp, guy) in users_store.iter() { 600 for (fp, guy) in users_store.iter() {
595 if !guy.is_bot { 601 if !guy.is_bot {
@@ -877,7 +883,10 @@ fn authorize_proposer(jwt_token: String, user_pem: &str) -> Result<TokenData<Cla
877 return Err(String::from("This token has expired")); 883 return Err(String::from("This token has expired"));
878 } 884 }
879 _ => { 885 _ => {
880 warn!("AN UNSPECIFIED ERROR from token: {}\nerr: {:?} key was {}", jwt_token, err, user_pem); 886 warn!(
887 "AN UNSPECIFIED ERROR from token: {}\nerr: {:?} key was {}",
888 jwt_token, err, user_pem
889 );
881 return Err(format!("JWT Error: {}", err)); 890 return Err(format!("JWT Error: {}", err));
882 } 891 }
883 }, 892 },