From bacedcecc51d4f8be610c6a1f4c1d0643faf8146 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 11 Apr 2022 19:09:48 +0300 Subject: [WIP] more spring cleaning --- Cargo.lock | 63 --------------------------------------------------------- Cargo.toml | 1 - src/handlers.rs | 9 --------- 3 files changed, 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1cec047..8228d5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,12 +351,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -486,7 +480,6 @@ dependencies = [ "hex-literal", "jsonwebtoken", "lazy_static", - "libmath", "log", "log4rs", "md-5", @@ -748,15 +741,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" -[[package]] -name = "libmath" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfd3416934a853ae80d5c3b006f632dfcbaf320300c5167e88a469e9ac214502" -dependencies = [ - "rand 0.3.23", -] - [[package]] name = "linked-hash-map" version = "0.5.4" @@ -1209,29 +1193,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" -[[package]] -name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi 0.3.9", -] - [[package]] name = "rand" version = "0.7.3" @@ -1277,21 +1238,6 @@ dependencies = [ "rand_core 0.6.2", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.5.1" @@ -1328,15 +1274,6 @@ dependencies = [ "rand_core 0.6.2", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.1.57" diff --git a/Cargo.toml b/Cargo.toml index 6bae27f..77efd25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ sha2 = "0.9.3" block-modes = "0.7.0" aes = "0.6.0" askama = "0.10.5" -libmath = "0.2.1" [dev-dependencies] serde_test = "1.0.117" 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; const TX_LOWER_LIMIT: u16 = 1; // Transaction traffic reward const TX_TRAFFIC_REWARD: u16 = 1; -// Staking reward -const STAKING_REWARD: f64 = 0.1; // Percentage // Encryption primitive type Aes128Cbc = Cbc; @@ -564,7 +562,6 @@ pub async fn propose_block( if let Some(transaction) = pending_transactions.remove(fingerprint) { let source = &transaction.source; let target = &transaction.target; - let is_source_bot = users_store.get(source).unwrap().is_bot; if let Some(from) = users_store.get_mut(source) { from.balance -= transaction.amount - TX_TRAFFIC_REWARD; @@ -572,12 +569,6 @@ pub async fn propose_block( if let Some(to) = users_store.get_mut(target) { to.balance += transaction.amount; - if is_source_bot { - // Add staking reward - to.balance += - math::round::ceil((f64::from(transaction.amount)) * STAKING_REWARD, 0) - as u16; - } } // if the receiver is a bot, they will reciprocate -- cgit v1.2.3-70-g09d2