Skip to content

Commit

Permalink
fix: off by one error in average_case_delete_operations_for_delete_up…
Browse files Browse the repository at this point in the history
…_tree_while_empty
  • Loading branch information
QuantumExplorer committed Dec 13, 2022
1 parent 5d2c15e commit 6864631
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions grovedb/src/operations/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ impl GroveDb {
is_sum_tree,
) = cost_return_on_error_no_add!(
&cost,
if height == path_len {
if height == path_len - 1 {
if let Some(layer_info) = estimated_layer_info.get(height as u64) {
let estimated_value_len = cost_return_on_error_no_add!(
&cost,
Expand Down Expand Up @@ -715,7 +715,7 @@ impl GroveDb {
layer_info.is_sum_tree,
))
} else {
Err(Error::InvalidParameter("intermediate flag size missing"))
Err(Error::InvalidParameter("intermediate layer info missing"))
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion merk/src/estimated_costs/average_case_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl EstimatedLayerSizes {
},
_ => {
return Err(Error::WrongEstimatedCostsElementTypeForLevel(
"this layer is needs to have trees",
"this layer needs to have trees",
));
}
}
Expand Down

0 comments on commit 6864631

Please sign in to comment.