The new incrementalwitnesstree package seems very cool and fast. I’d love to use it, but I’m not 100% sure how to.
Zecwallet maintains a collection of IncrementalWitness<Node>, one for each note that the user has. It then increments this by calling ::append(Node) for each Sapling output. This is duplicated one for each note that user has.
I’d like to change this to use a single incrementalwitnesstree::BridgeTree, but I’m not clear how I’d construct a single BridgeTree using all of the IncrementalWitness<Node> in the user’s wallet.
I can construct a NonEmptyFrontier from each of the CommitmentTree<Node>, and then fuse() them together, calling witness() each time to mark that node for witnessing when the note is spent.
But how can I get the frontier from the IncrementalWitness? i.e., How can I get the tree state at the time the note was created from a IncrementalWitness<Node>? Am I understanding this correctly?