Serialization/Deserialization fails for empty node hashes
Ash-L2L opened this issue · 0 comments
Ash-L2L commented
use rustreexo::accumulator::{node_hash::NodeHash, pollard::Pollard};
#[test]
fn test_pollard_serialization() {
let mut p = Pollard::new();
let values = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let hashes: Vec<NodeHash> = values
.into_iter()
.map(|i| NodeHash::from([i; 32]))
.collect();
p.modify(&hashes, &[]).expect("modify should work");
p.modify(&[], &hashes).expect("modify should work");
let mut serialized= Vec::<u8>::new();
p.serialize(&mut serialized).expect("serialize should work");
let _pollard = Pollard::deserialize(&*serialized).expect("deserialization fails");
}