Open ImplOfAnImpl opened 1 week ago
Can we move this to its own crate in utils?
in_mem_block_tree
depends on common
because it needs primitives related to blocks, such as Id
and GenBlock
. So, utils
is not a good place for it.
But I agree that the current place is not the best for it either.
Can we move this to its own crate in utils?
in_mem_block_tree
depends oncommon
because it needs primitives related to blocks, such asId
andGenBlock
. So,utils
is not a good place for it. But I agree that the current place is not the best for it either.
I've abstracted Id<GenBlock>
away from it and then moved it to utils
.
Some caveats:
1) I've renamed it to in_mem_item_tree
, because the crate has nothing to do with blocks anymore; I don't really like this new name, but I couldn't come up with anything better.
2) utils/in_mem_item_tree
depends on utils
and not vice versa, like its other crates. This doesn't look nice, but we already have similar inconsistency in other places, e.g. in the wallet, so I guess it's ok?
That's alright.
This is the generalized version of the "in-memory block tree" from #1768 . The corresponding
Trees
/Tree
/TreeRef
structs are intree_wrappers.rs
. However, I also had to wrap allindextree
's primitives (which are in theprimitives
module), so that they can be exposed to the user and still maintain the required guarantees (i.e. that a parent/child nodes will always correspond to parent/child blocks).