pub fn sparse_merkle_insert_batch(
db_info: DbHandle,
db_smt: DbHandle,
db_roots: DbHandle,
root_key: &[u8],
elements: &[Base],
) -> GenericResult<()>Expand description
Add given elements into a sparse Merkle tree. Used for exclusion proofs.
db_infois a handle for a database where the latest root is stored.db_smtis a handle for a database where all the actual tree is stored.db_rootsis a handle for a database where all the new roots are stored.root_keyis the serialized key pointing to the latest Merkle root indb_infoelementsare the items we want to add to the tree.
There are 2 databases:
db_infostores general metadata or info.db_rootsstores a log of all the merkle roots.
Inside db_info we store:
- The [latest root hash:32] under
root_key.
Inside db_roots we store:
- All [merkle root:32]s as keys. The value is the current [tx_hash:32][call_idx:1]. If no new values are added, then the root key is updated to the current (tx_hash, call_idx).