Updated dependencies.

This commit is contained in:
Revertron
2023-03-01 13:18:18 +01:00
parent 17456e7a6c
commit 748ec8273f
5 changed files with 124 additions and 38 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ pub fn key_hash_difficulty(hash: &[u8]) -> u32 {
#[inline]
pub fn hash_sha256(data: &[u8]) -> Vec<u8> {
let mut digest = Sha256::default();
digest.update(data.as_ref());
digest.update(data);
Vec::from(&digest.finalize()[..])
}
+1 -1
View File
@@ -72,7 +72,7 @@ impl Keystore {
let path = Path::new(filename);
match fs::read(&path) {
Ok(key) => {
match toml::from_slice::<Keys>(key.as_slice()) {
match toml::from_str::<Keys>(&String::from_utf8(key).unwrap_or_default()) {
Ok(keys) => {
let secret = SecretKey::from_bytes(&from_hex(&keys.signing.secret).unwrap()).unwrap();
let public = PublicKey::from_bytes(&from_hex(&keys.signing.public).unwrap()).unwrap();
+3 -3
View File
@@ -431,7 +431,7 @@ impl Network {
}
State::Idle { from } => {
debug!("Odd version of pings for {}", peer.get_addr().ip());
if from.elapsed().as_secs() >= 30 {
if from.elapsed().as_secs() >= 120 {
let data: Vec<u8> = {
let c = self.context.lock().unwrap();
let message = Message::ping(c.chain.get_height(), c.chain.get_last_hash());
@@ -542,7 +542,7 @@ impl Network {
if peer.is_higher(my_height) {
let mut context = self.context.lock().unwrap();
context.chain.update_max_height(height);
info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip());
info!("Peer is higher, requesting block {} from {}", my_height + 1, peer.get_addr().ip());
State::message(Message::GetBlock { index: my_height + 1 })
} else if my_height == height && hash.ne(&my_hash) {
info!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip());
@@ -563,7 +563,7 @@ impl Network {
if peer.is_higher(my_height) {
let mut context = self.context.lock().unwrap();
context.chain.update_max_height(height);
info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip());
info!("Peer is higher, requesting block {} from {}", my_height + 1, peer.get_addr().ip());
State::message(Message::GetBlock { index: my_height + 1 })
} else if my_height == height && hash.ne(&my_hash) {
info!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip());