From f9fb935264cc8a3e21342c5b07e086ab02310301 Mon Sep 17 00:00:00 2001 From: Revertron Date: Thu, 9 Jun 2022 16:57:48 +0200 Subject: [PATCH] Fixed ban mechanism, updated dependencies. --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 8 ++++---- src/commons/constants.rs | 2 +- src/p2p/peers.rs | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eae9d8c..fbbdb19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,7 +84,7 @@ dependencies = [ [[package]] name = "alfis" -version = "0.7.3" +version = "0.7.4" dependencies = [ "base64", "bincode", @@ -735,9 +735,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32613e41de4c47ab04970c348ca7ae7382cf116625755af070b008a15516a889" +checksum = "8015d95cb7b2ddd3c0d32ca38283ceb1eea09b4713ee380bceb942d85a244228" dependencies = [ "hashbrown", ] @@ -833,12 +833,12 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0524af9508f9b5c4eb41dce095860456727748f63b478d625f119a70e0d764a" +checksum = "f2423ffbf445b82e58c3b1543655968923dd06f85432f10be2bb4f1b7122f98c" dependencies = [ "pathdiff", - "winapi", + "windows-sys", ] [[package]] @@ -1446,9 +1446,9 @@ checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" [[package]] name = "uuid" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0" +checksum = "c6d5d669b51467dcf7b2f1a796ce0f955f05f01cafda6c19d6e95f730df29238" dependencies = [ "getrandom 0.2.3", "serde", diff --git a/Cargo.toml b/Cargo.toml index 7f0812c..4503bf1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alfis" -version = "0.7.3" +version = "0.7.4" authors = ["Revertron "] edition = "2021" build = "build.rs" @@ -37,17 +37,17 @@ time = "0.3.9" rand = { version = "0.8.5", package = "rand" } rand-old = { package = "rand", version = "0.7.0" } # For ed25519-dalek sqlite = "0.26.0" -uuid = { version = "1.0.0", features = ["serde", "v4"] } +uuid = { version = "1.1.1", features = ["serde", "v4"] } mio = { version = "0.8.3", features = ["os-poll", "net"] } ureq = { version = "2.4", optional = true } -lru = "0.7.5" +lru = "0.7.6" derive_more = "0.99.17" lazy_static = "1.4.0" # Optional dependencies regulated by features web-view = { version = "0.7.3", features = [], optional = true } tinyfiledialogs = { version = "3.9.1", optional = true } -open = { version = "2.1.2", optional = true } +open = { version = "2.1.3", optional = true } [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", features = ["impl-default", "wincon", "shellscalingapi"] } diff --git a/src/commons/constants.rs b/src/commons/constants.rs index 29851fb..e63d105 100644 --- a/src/commons/constants.rs +++ b/src/commons/constants.rs @@ -49,4 +49,4 @@ pub const MIN_CONNECTED_NODES_START_SYNC: usize = 4; pub const MAX_READ_BLOCK_TIME: u128 = 100; pub const MAX_RECONNECTS: u32 = 5; pub const MAX_IDLE_SECONDS: u64 = 180; -pub const MAX_NODES: usize = 25; +pub const MAX_NODES: usize = 20; diff --git a/src/p2p/peers.rs b/src/p2p/peers.rs index cd06665..53a0bd1 100644 --- a/src/p2p/peers.rs +++ b/src/p2p/peers.rs @@ -268,9 +268,10 @@ impl Peers { } // Just purging ignored/banned IPs every 10 minutes - // TODO make it individual + // TODO make it individual for every IP if self.ignore_timer.elapsed().as_secs() >= 600 { self.ignored.clear(); + self.ignore_timer = Instant::now(); } // If someone has more blocks we sync