mirror of https://github.com/vacp2p/pmtree.git
feat: add batch_insert function
This commit is contained in:
parent
ea8c7a5264
commit
6185354f78
|
@ -3,6 +3,9 @@ name = "pmtree"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
batch_insert = []
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex-literal = "0.3.4"
|
hex-literal = "0.3.4"
|
||||||
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
|
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
|
||||||
|
|
|
@ -188,6 +188,13 @@ where
|
||||||
Ok(())
|
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
|
/// Computes a Merkle proof for the leaf at the specified index
|
||||||
pub fn proof(&self, index: usize) -> Result<MerkleProof<H>> {
|
pub fn proof(&self, index: usize) -> Result<MerkleProof<H>> {
|
||||||
if index >= self.capacity() {
|
if index >= self.capacity() {
|
||||||
|
|
Loading…
Reference in New Issue