Updated all dependencies.

This commit is contained in:
Revertron
2025-10-27 01:22:02 +01:00
parent 61f2d89ef1
commit 81f5568957
5 changed files with 369 additions and 241 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ extern crate serde_json;
use std::cell::RefCell;
use std::fmt::Debug;
use bincode::config;
use serde::{Deserialize, Serialize};
use crate::blockchain::hash_utils::{hash_difficulty, key_hash_difficulty};
@@ -94,7 +94,7 @@ impl Block {
/// Serializes block to bincode format for hashing.
pub fn as_bytes_compact(&self) -> Vec<u8> {
bincode::serialize(&self).unwrap()
bincode::serde::encode_to_vec(&self, config::legacy()).unwrap()
}
/// Checks if this block is superior to the other
+9 -4
View File
@@ -15,9 +15,14 @@ pub struct Chacha {
impl Chacha {
pub fn new(key: &[u8], nonce: &[u8]) -> Self {
let key = Key::from_slice(key);
let cipher = ChaCha20Poly1305::new(key);
let nonce = Nonce::clone_from_slice(nonce);
// Convert slices to fixed-size arrays, then to GenericArray
let key_array: [u8; 32] = key.try_into().expect("Key must be 32 bytes");
let key = Key::from(key_array);
let cipher = ChaCha20Poly1305::new(&key);
let nonce_array: [u8; 12] = nonce.try_into().expect("Nonce must be 12 bytes");
let nonce = Nonce::from(nonce_array);
Chacha { cipher, nonce }
}
@@ -30,7 +35,7 @@ impl Chacha {
}
pub fn get_nonce(&self) -> &[u8] {
&self.nonce.as_slice()
self.nonce.as_ref()
}
}
+1 -1
View File
@@ -243,7 +243,7 @@ mod tests {
}));
match Arc::get_mut(&mut context) {
Some(mut ctx) => {
Some(ctx) => {
ctx.resolve_strategy = ResolveStrategy::Forward { upstreams: vec![String::from("127.0.0.1:53")] };
}
None => panic!()