From 6185354f785dbe2eb2898a5b79edfd034b47ee0e Mon Sep 17 00:00:00 2001 From: Magamedrasul Ibragimov Date: Fri, 2 Dec 2022 20:53:03 +0300 Subject: [PATCH] feat: add batch_insert function --- Cargo.toml | 3 +++ src/tree.rs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 14e7913..ea89dd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,9 @@ name = "pmtree" version = "0.1.0" edition = "2021" +[features] +batch_insert = [] + [dev-dependencies] hex-literal = "0.3.4" tiny-keccak = { version = "2.0.2", features = ["keccak"] } diff --git a/src/tree.rs b/src/tree.rs index 22f5d23..407c087 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -188,6 +188,13 @@ where Ok(()) } + /// Batch insertion, updates the tree in parallel. + /// Only available as a feature + #[cfg(feature = "batch_insert")] + pub fn batch_insert(&mut self, leaves: &[H::Fr]) -> Result<()> { + Ok(()) + } + /// Computes a Merkle proof for the leaf at the specified index pub fn proof(&self, index: usize) -> Result> { if index >= self.capacity() {