diff options
| -rw-r--r-- | Cargo.lock | 63 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/handlers.rs | 9 |
3 files changed, 0 insertions, 73 deletions
| @@ -352,12 +352,6 @@ dependencies = [ | |||
| 352 | ] | 352 | ] |
| 353 | 353 | ||
| 354 | [[package]] | 354 | [[package]] |
| 355 | name = "fuchsia-cprng" | ||
| 356 | version = "0.1.1" | ||
| 357 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 358 | checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" | ||
| 359 | |||
| 360 | [[package]] | ||
| 361 | name = "fuchsia-zircon" | 355 | name = "fuchsia-zircon" |
| 362 | version = "0.3.3" | 356 | version = "0.3.3" |
| 363 | source = "registry+https://github.com/rust-lang/crates.io-index" | 357 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -486,7 +480,6 @@ dependencies = [ | |||
| 486 | "hex-literal", | 480 | "hex-literal", |
| 487 | "jsonwebtoken", | 481 | "jsonwebtoken", |
| 488 | "lazy_static", | 482 | "lazy_static", |
| 489 | "libmath", | ||
| 490 | "log", | 483 | "log", |
| 491 | "log4rs", | 484 | "log4rs", |
| 492 | "md-5", | 485 | "md-5", |
| @@ -749,15 +742,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 749 | checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" | 742 | checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" |
| 750 | 743 | ||
| 751 | [[package]] | 744 | [[package]] |
| 752 | name = "libmath" | ||
| 753 | version = "0.2.1" | ||
| 754 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 755 | checksum = "dfd3416934a853ae80d5c3b006f632dfcbaf320300c5167e88a469e9ac214502" | ||
| 756 | dependencies = [ | ||
| 757 | "rand 0.3.23", | ||
| 758 | ] | ||
| 759 | |||
| 760 | [[package]] | ||
| 761 | name = "linked-hash-map" | 745 | name = "linked-hash-map" |
| 762 | version = "0.5.4" | 746 | version = "0.5.4" |
| 763 | source = "registry+https://github.com/rust-lang/crates.io-index" | 747 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1211,29 +1195,6 @@ checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" | |||
| 1211 | 1195 | ||
| 1212 | [[package]] | 1196 | [[package]] |
| 1213 | name = "rand" | 1197 | name = "rand" |
| 1214 | version = "0.3.23" | ||
| 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1216 | checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" | ||
| 1217 | dependencies = [ | ||
| 1218 | "libc", | ||
| 1219 | "rand 0.4.6", | ||
| 1220 | ] | ||
| 1221 | |||
| 1222 | [[package]] | ||
| 1223 | name = "rand" | ||
| 1224 | version = "0.4.6" | ||
| 1225 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1226 | checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" | ||
| 1227 | dependencies = [ | ||
| 1228 | "fuchsia-cprng", | ||
| 1229 | "libc", | ||
| 1230 | "rand_core 0.3.1", | ||
| 1231 | "rdrand", | ||
| 1232 | "winapi 0.3.9", | ||
| 1233 | ] | ||
| 1234 | |||
| 1235 | [[package]] | ||
| 1236 | name = "rand" | ||
| 1237 | version = "0.7.3" | 1198 | version = "0.7.3" |
| 1238 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1199 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1239 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" | 1200 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" |
| @@ -1279,21 +1240,6 @@ dependencies = [ | |||
| 1279 | 1240 | ||
| 1280 | [[package]] | 1241 | [[package]] |
| 1281 | name = "rand_core" | 1242 | name = "rand_core" |
| 1282 | version = "0.3.1" | ||
| 1283 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1284 | checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" | ||
| 1285 | dependencies = [ | ||
| 1286 | "rand_core 0.4.2", | ||
| 1287 | ] | ||
| 1288 | |||
| 1289 | [[package]] | ||
| 1290 | name = "rand_core" | ||
| 1291 | version = "0.4.2" | ||
| 1292 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1293 | checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" | ||
| 1294 | |||
| 1295 | [[package]] | ||
| 1296 | name = "rand_core" | ||
| 1297 | version = "0.5.1" | 1243 | version = "0.5.1" |
| 1298 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1244 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1299 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" | 1245 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" |
| @@ -1329,15 +1275,6 @@ dependencies = [ | |||
| 1329 | ] | 1275 | ] |
| 1330 | 1276 | ||
| 1331 | [[package]] | 1277 | [[package]] |
| 1332 | name = "rdrand" | ||
| 1333 | version = "0.4.0" | ||
| 1334 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1335 | checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" | ||
| 1336 | dependencies = [ | ||
| 1337 | "rand_core 0.3.1", | ||
| 1338 | ] | ||
| 1339 | |||
| 1340 | [[package]] | ||
| 1341 | name = "redox_syscall" | 1278 | name = "redox_syscall" |
| 1342 | version = "0.1.57" | 1279 | version = "0.1.57" |
| 1343 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1280 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -27,7 +27,6 @@ sha2 = "0.9.3" | |||
| 27 | block-modes = "0.7.0" | 27 | block-modes = "0.7.0" |
| 28 | aes = "0.6.0" | 28 | aes = "0.6.0" |
| 29 | askama = "0.10.5" | 29 | askama = "0.10.5" |
| 30 | libmath = "0.2.1" | ||
| 31 | 30 | ||
| 32 | [dev-dependencies] | 31 | [dev-dependencies] |
| 33 | serde_test = "1.0.117" | 32 | 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; | |||
| 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 |
