From 4c3003c384f430a59dcb8f06c9acd1f4980b6f28 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 10 Dec 2024 10:09:28 -0500 Subject: [PATCH] fixup --- crates/chia-datalayer/src/merkle.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/chia-datalayer/src/merkle.rs b/crates/chia-datalayer/src/merkle.rs index 1005a490d..0e2a28a8f 100644 --- a/crates/chia-datalayer/src/merkle.rs +++ b/crates/chia-datalayer/src/merkle.rs @@ -398,6 +398,7 @@ fn get_free_indexes_and_keys_values_indexes( #[derive(Debug)] pub struct MerkleBlob { blob: Vec, + // TODO: would be nice for this to be deterministic ala a fifo set free_indexes: HashSet, key_to_index: HashMap, } @@ -2287,6 +2288,8 @@ mod tests { assert!(!small_blob.free_indexes.contains(&index)); small_blob.delete(key).unwrap(); assert!(small_blob.free_indexes.contains(&index)); + let free_indexes = small_blob.free_indexes.clone(); + assert_eq!(free_indexes.len(), 2); let new_index = small_blob .insert( KvId(count), @@ -2296,7 +2299,7 @@ mod tests { ) .unwrap(); assert_eq!(small_blob.blob.len(), expected_length); - assert_eq!(new_index, index); + assert!(free_indexes.contains(&new_index)); assert!(small_blob.free_indexes.is_empty()); } }