diff options
| author | Yigit Sever | 2022-04-11 19:09:48 +0300 |
|---|---|---|
| committer | Yigit Sever | 2022-04-11 19:09:48 +0300 |
| commit | bacedcecc51d4f8be610c6a1f4c1d0643faf8146 (patch) | |
| tree | 99afab3a850d5c339cf55e1c69232228cf1ce5b7 /src/handlers.rs | |
| parent | 426e83ec6fba028692bed334803ae9d3a645cb18 (diff) | |
| download | gradecoin-bacedcecc51d4f8be610c6a1f4c1d0643faf8146.tar.gz gradecoin-bacedcecc51d4f8be610c6a1f4c1d0643faf8146.tar.bz2 gradecoin-bacedcecc51d4f8be610c6a1f4c1d0643faf8146.zip | |
[WIP] more spring cleaning
Diffstat (limited to 'src/handlers.rs')
| -rw-r--r-- | src/handlers.rs | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index 8d8b62f..a64c012 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
| @@ -37,8 +37,6 @@ const TX_UPPER_LIMIT: u16 = 10; | |||
| 37 | const TX_LOWER_LIMIT: u16 = 1; | 37 | const TX_LOWER_LIMIT: u16 = 1; |
| 38 | // Transaction traffic reward | 38 | // Transaction traffic reward |
| 39 | const TX_TRAFFIC_REWARD: u16 = 1; | 39 | const TX_TRAFFIC_REWARD: u16 = 1; |
| 40 | // Staking reward | ||
| 41 | const STAKING_REWARD: f64 = 0.1; // Percentage | ||
| 42 | 40 | ||
| 43 | // Encryption primitive | 41 | // Encryption primitive |
| 44 | type Aes128Cbc = Cbc<Aes128, Pkcs7>; | 42 | type Aes128Cbc = Cbc<Aes128, Pkcs7>; |
| @@ -564,7 +562,6 @@ pub async fn propose_block( | |||
| 564 | if let Some(transaction) = pending_transactions.remove(fingerprint) { | 562 | if let Some(transaction) = pending_transactions.remove(fingerprint) { |
| 565 | let source = &transaction.source; | 563 | let source = &transaction.source; |
| 566 | let target = &transaction.target; | 564 | let target = &transaction.target; |
| 567 | let is_source_bot = users_store.get(source).unwrap().is_bot; | ||
| 568 | 565 | ||
| 569 | if let Some(from) = users_store.get_mut(source) { | 566 | if let Some(from) = users_store.get_mut(source) { |
| 570 | from.balance -= transaction.amount - TX_TRAFFIC_REWARD; | 567 | from.balance -= transaction.amount - TX_TRAFFIC_REWARD; |
| @@ -572,12 +569,6 @@ pub async fn propose_block( | |||
| 572 | 569 | ||
| 573 | if let Some(to) = users_store.get_mut(target) { | 570 | if let Some(to) = users_store.get_mut(target) { |
| 574 | to.balance += transaction.amount; | 571 | to.balance += transaction.amount; |
| 575 | if is_source_bot { | ||
| 576 | // Add staking reward | ||
| 577 | to.balance += | ||
| 578 | math::round::ceil((f64::from(transaction.amount)) * STAKING_REWARD, 0) | ||
| 579 | as u16; | ||
| 580 | } | ||
| 581 | } | 572 | } |
| 582 | 573 | ||
| 583 | // if the receiver is a bot, they will reciprocate | 574 | // if the receiver is a bot, they will reciprocate |
