shardtree: Derive correct shard root addrs in `ShardTree::insert_tree`
`LocatedTree::decompose_to_level` will return the tree as-is if it is smaller than a shard, so we can't assume that the address of `subtree` is a valid shard address.
This commit is contained in:
parent
f23b5f314f
commit
1eda8b2e24
|
@ -587,7 +587,11 @@ impl<
|
|||
) -> Result<Vec<IncompleteAt>, ShardTreeError<S::Error>> {
|
||||
let mut all_incomplete = vec![];
|
||||
for subtree in tree.decompose_to_level(Self::subtree_level()).into_iter() {
|
||||
let root_addr = subtree.root_addr;
|
||||
// `LocatedTree::decompose_to_level` will return the tree as-is if it is
|
||||
// smaller than a shard, so we can't assume that the address of `subtree` is a
|
||||
// valid shard address.
|
||||
let root_addr = Self::subtree_addr(subtree.root_addr.position_range_start());
|
||||
|
||||
let contains_marked = subtree.root.contains_marked();
|
||||
let (new_subtree, mut incomplete) = self
|
||||
.store
|
||||
|
|
Loading…
Reference in New Issue