Updated all dependencies.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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!()
|
||||
|
||||
Reference in New Issue
Block a user