shardtree: Fix pruning of annotated `Parent` nodes with `Nil` children.
The current behavior of `unite` incorrectly discards annotation data.
This commit is contained in:
parent
08d3e23977
commit
f5adcd5a2c
|
@ -24,6 +24,9 @@ and this project adheres to Rust's notion of
|
||||||
- Fixes an error that could occur if an inserted `Frontier` node was
|
- Fixes an error that could occur if an inserted `Frontier` node was
|
||||||
interpreted as a node that had actually had its value observed as though it
|
interpreted as a node that had actually had its value observed as though it
|
||||||
had been inserted using the ordinary tree insertion methods.
|
had been inserted using the ordinary tree insertion methods.
|
||||||
|
- Fixes an error in an internal method that could result in subtree root
|
||||||
|
annotation data being discarded when pruning a `Parent` node having
|
||||||
|
`Nil` nodes for both its left and right children.
|
||||||
|
|
||||||
## [0.3.1] - 2024-04-03
|
## [0.3.1] - 2024-04-03
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ impl<H: Hashable + Clone + PartialEq> PrunableTree<H> {
|
||||||
/// `level` must be the level of the two nodes that are being joined.
|
/// `level` must be the level of the two nodes that are being joined.
|
||||||
pub(crate) fn unite(level: Level, ann: Option<Arc<H>>, left: Self, right: Self) -> Self {
|
pub(crate) fn unite(level: Level, ann: Option<Arc<H>>, left: Self, right: Self) -> Self {
|
||||||
match (left, right) {
|
match (left, right) {
|
||||||
(Tree(Node::Nil), Tree(Node::Nil)) => Tree::empty(),
|
(Tree(Node::Nil), Tree(Node::Nil)) if ann.is_none() => Tree::empty(),
|
||||||
(Tree(Node::Leaf { value: lv }), Tree(Node::Leaf { value: rv }))
|
(Tree(Node::Leaf { value: lv }), Tree(Node::Leaf { value: rv }))
|
||||||
// we can prune right-hand leaves that are not marked or reference leaves; if a
|
// we can prune right-hand leaves that are not marked or reference leaves; if a
|
||||||
// leaf is a checkpoint then that information will be propagated to the replacement
|
// leaf is a checkpoint then that information will be propagated to the replacement
|
||||||
|
|
Loading…
Reference in New Issue