The previous code's buildTree functions actually perform proof generations only, the whole Merkle Tree is not built and stored. However, it is necessary to keep the whole tree sometimes. For example, when you only needs the proofs of several data blocks, it is very costly to use the poof generation method to calculate the proofs for the whole set. So I implement the new tree building method, and defined three modes for Merkle Tree configuration:
ModeProofGen: also the default mode, generates proofs only,
ModeTreeBuild: builds up the Merkle Tree only, can use the Merke Tree to retrieve the proof of a certain data block,
ModeProofGenAndTreeBuild: we have the first and the second, why not both 😜
The previous code's buildTree functions actually perform proof generations only, the whole Merkle Tree is not built and stored. However, it is necessary to keep the whole tree sometimes. For example, when you only needs the proofs of several data blocks, it is very costly to use the poof generation method to calculate the proofs for the whole set. So I implement the new tree building method, and defined three modes for Merkle Tree configuration: