Add counter-resets to reset_modifications
This commit is contained in:
parent
0599d3f1f8
commit
fbf8fad4f1
@ -45,11 +45,6 @@ impl TreeHashCache {
|
||||
if self.is_empty() {
|
||||
Err(Error::CacheNotInitialized)
|
||||
} else {
|
||||
// Reset the per-hash counters.
|
||||
self.chunk_index = 0;
|
||||
self.schema_index = 0;
|
||||
|
||||
// Reset the "modified" flags for the cache.
|
||||
self.reset_modifications();
|
||||
|
||||
item.update_tree_hash_cache(self)
|
||||
@ -156,6 +151,10 @@ impl TreeHashCache {
|
||||
}
|
||||
|
||||
pub fn reset_modifications(&mut self) {
|
||||
// Reset the per-hash counters.
|
||||
self.chunk_index = 0;
|
||||
self.schema_index = 0;
|
||||
|
||||
for chunk_modified in &mut self.chunk_modified {
|
||||
*chunk_modified = false;
|
||||
}
|
||||
@ -243,6 +242,10 @@ impl TreeHashCache {
|
||||
self.cache.len()
|
||||
}
|
||||
|
||||
pub fn tree_hash_root(&self) -> Result<&[u8], Error> {
|
||||
self.root()
|
||||
}
|
||||
|
||||
pub fn root(&self) -> Result<&[u8], Error> {
|
||||
if self.is_empty() {
|
||||
Err(Error::CacheNotInitialized)
|
||||
|
Loading…
Reference in New Issue
Block a user