diff options
author | Yigit Sever | 2021-05-01 19:05:30 +0300 |
---|---|---|
committer | Yigit Sever | 2021-05-01 19:05:30 +0300 |
commit | 05aecacaf8522650d2cd2fd01bddfc0585a7fa4e (patch) | |
tree | 16528e44a4f7d4d28639c9a2b3f1226498ebbc5a | |
parent | ed0fdc25468e0eb7fee3cd9c9fa2484b83e9a021 (diff) | |
download | gradecoin-05aecacaf8522650d2cd2fd01bddfc0585a7fa4e.tar.gz gradecoin-05aecacaf8522650d2cd2fd01bddfc0585a7fa4e.tar.bz2 gradecoin-05aecacaf8522650d2cd2fd01bddfc0585a7fa4e.zip |
Increase tx limit, decrease block size
Thank you Abdelrahman Abounegm for suggestions
-rw-r--r-- | src/handlers.rs | 8 |
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}; | |||
22 | use crate::PRIVATE_KEY; | 22 | use crate::PRIVATE_KEY; |
23 | 23 | ||
24 | // Valid blocks should have this many transactions | 24 | // Valid blocks should have this many transactions |
25 | const BLOCK_TRANSACTION_COUNT: u8 = 10; | 25 | const BLOCK_TRANSACTION_COUNT: u8 = 8; |
26 | // Inital registration bonus | 26 | // Inital registration bonus |
27 | const REGISTER_BONUS: u16 = 40; | 27 | const REGISTER_BONUS: u16 = 40; |
28 | // Coinbase reward | 28 | // Coinbase reward |
29 | const BLOCK_REWARD: u16 = 3; | 29 | const BLOCK_REWARD: u16 = 3; |
30 | // Transaction amount limit | 30 | // Transaction amount limit |
31 | const TX_UPPER_LIMIT: u16 = 2; | 31 | const TX_UPPER_LIMIT: u16 = 10; |
32 | const TX_LOWER_LIMIT: u16 = 1; | 32 | const TX_LOWER_LIMIT: u16 = 1; |
33 | // Transaction traffic reward | 33 | // Transaction traffic reward |
34 | const TX_TRAFFIC_REWARD: u16 = 1; | 34 | const 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 |