aboutsummaryrefslogtreecommitdiffstats
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorYigit Sever2021-05-01 19:05:30 +0300
committerYigit Sever2021-05-01 19:05:30 +0300
commit05aecacaf8522650d2cd2fd01bddfc0585a7fa4e (patch)
tree16528e44a4f7d4d28639c9a2b3f1226498ebbc5a /src/handlers.rs
parented0fdc25468e0eb7fee3cd9c9fa2484b83e9a021 (diff)
downloadgradecoin-05aecacaf8522650d2cd2fd01bddfc0585a7fa4e.tar.gz
gradecoin-05aecacaf8522650d2cd2fd01bddfc0585a7fa4e.tar.bz2
gradecoin-05aecacaf8522650d2cd2fd01bddfc0585a7fa4e.zip
Increase tx limit, decrease block size
Thank you Abdelrahman Abounegm for suggestions
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index 09ce4a5..a9299fe 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -22,13 +22,13 @@ use warp::{http::StatusCode, reply};
22use crate::PRIVATE_KEY; 22use crate::PRIVATE_KEY;
23 23
24// Valid blocks should have this many transactions 24// Valid blocks should have this many transactions
25const BLOCK_TRANSACTION_COUNT: u8 = 10; 25const BLOCK_TRANSACTION_COUNT: u8 = 8;
26// Inital registration bonus 26// Inital registration bonus
27const REGISTER_BONUS: u16 = 40; 27const REGISTER_BONUS: u16 = 40;
28// Coinbase reward 28// Coinbase reward
29const BLOCK_REWARD: u16 = 3; 29const BLOCK_REWARD: u16 = 3;
30// Transaction amount limit 30// Transaction amount limit
31const TX_UPPER_LIMIT: u16 = 2; 31const TX_UPPER_LIMIT: u16 = 10;
32const TX_LOWER_LIMIT: u16 = 1; 32const TX_LOWER_LIMIT: u16 = 1;
33// Transaction traffic reward 33// Transaction traffic reward
34const TX_TRAFFIC_REWARD: u16 = 1; 34const TX_TRAFFIC_REWARD: u16 = 1;
@@ -563,11 +563,11 @@ pub async fn propose_block(
563 let target = &transaction.target; 563 let target = &transaction.target;
564 564
565 if let Some(from) = users_store.get_mut(source) { 565 if let Some(from) = users_store.get_mut(source) {
566 from.balance -= transaction.amount; 566 from.balance -= transaction.amount - TX_TRAFFIC_REWARD;
567 } 567 }
568 568
569 if let Some(to) = users_store.get_mut(target) { 569 if let Some(to) = users_store.get_mut(target) {
570 to.balance += transaction.amount + TX_TRAFFIC_REWARD; 570 to.balance += transaction.amount;
571 } 571 }
572 572
573 // if the receiver is a bot, they will reciprocate 573 // if the receiver is a bot, they will reciprocate