Optimized new block processing. Added quick-ban for those, who send wrong blocks.

This commit is contained in:
Revertron
2021-04-17 01:51:14 +02:00
parent de61d17845
commit 47c398118a
4 changed files with 72 additions and 57 deletions
+10 -1
View File
@@ -79,7 +79,16 @@ impl Peer {
}
pub fn has_more_blocks(&self, height: u64) -> bool {
self.height > self.received_block && self.height > height && self.get_state().is_idle()
if self.height <= height {
return false;
}
if self.received_block > height {
return false;
}
if !self.get_state().is_idle() {
return false;
}
self.height > height
}
pub fn is_public(&self) -> bool {