Optimized p2p communication. Disabled connections from v0.6.*. Updated dependencies.

This commit is contained in:
Revertron
2022-07-11 14:44:24 +02:00
parent ef5cef290e
commit 20054e4be7
5 changed files with 34 additions and 12 deletions
+14
View File
@@ -19,6 +19,7 @@ pub struct Peer {
active: bool,
reconnects: u32,
received_block: u64,
sent_height: u64,
cipher: Option<Chacha>,
fork: HashMap<u64, Block>
}
@@ -36,6 +37,7 @@ impl Peer {
active: false,
reconnects: 0,
received_block: 0,
sent_height: 0,
cipher: None,
fork: HashMap::new()
}
@@ -84,6 +86,18 @@ impl Peer {
self.height = height;
}
pub fn get_height(&self) -> u64 {
self.height
}
pub fn set_sent_height(&mut self, height: u64) {
self.sent_height = height;
}
pub fn get_sent_height(&self) -> u64 {
self.sent_height
}
pub fn is_higher(&self, height: u64) -> bool {
self.height > height
}