Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Dec 10, 2024
1 parent 71147a7 commit 4c3003c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/chia-datalayer/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ fn get_free_indexes_and_keys_values_indexes(
#[derive(Debug)]
pub struct MerkleBlob {
blob: Vec<u8>,
// TODO: would be nice for this to be deterministic ala a fifo set
free_indexes: HashSet<TreeIndex>,
key_to_index: HashMap<KvId, TreeIndex>,
}
Expand Down Expand Up @@ -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),
Expand All @@ -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());
}
}

0 comments on commit 4c3003c

Please sign in to comment.