-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring: extract merkle tree as crate (#223)
- Loading branch information
Showing
15 changed files
with
44 additions
and
509 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
[package] | ||
name = "merkle-tree" | ||
name = "ckb-merkle-tree" | ||
version = "0.5.0-pre" | ||
license = "MIT" | ||
authors = ["Nervos Core Dev <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dev-dependencies] | ||
proptest = "0.8" | ||
[dependencies] | ||
merkle-cbt = { version="0.1", features = ["sha3"] } |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
mod hash; | ||
mod proof; | ||
mod tree; | ||
use merkle_cbt::{MerkleProof, MerkleTree, CBMT, H256}; | ||
|
||
pub use crate::hash::Merge; | ||
pub use crate::proof::Proof; | ||
pub use crate::tree::Tree; | ||
pub fn merkle_root(leaves: &[H256]) -> H256 { | ||
CBMT::build_merkle_root(leaves) | ||
} | ||
|
||
pub fn build_merkle_tree(leaves: Vec<H256>) -> MerkleTree<H256> { | ||
CBMT::build_merkle_tree(leaves) | ||
} | ||
|
||
pub fn build_merkle_proof(leaves: &[H256], indices: &[usize]) -> Option<MerkleProof<H256>> { | ||
CBMT::build_merkle_proof(leaves, indices) | ||
} |
Oops, something went wrong.