make get_elem public (#14)

This commit is contained in:
Ekaterina Broslavskaya 2024-05-17 14:09:19 +07:00 committed by rymnc
parent a48c3d9400
commit 33adfaffef
No known key found for this signature in database
GPG Key ID: AAA088D5C68ECD34
1 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ const NEXT_INDEX_KEY: DBKey = u64::MAX.to_be_bytes();
// Denotes keys (depth, index) in Merkle Tree. Can be converted to DBKey // Denotes keys (depth, index) in Merkle Tree. Can be converted to DBKey
// TODO! Think about using hashing for that // TODO! Think about using hashing for that
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct Key(usize, usize); pub struct Key(usize, usize);
impl From<Key> for DBKey { impl From<Key> for DBKey {
fn from(key: Key) -> Self { fn from(key: Key) -> Self {
let cantor_pairing = ((key.0 + key.1) * (key.0 + key.1 + 1) / 2 + key.1) as u64; let cantor_pairing = ((key.0 + key.1) * (key.0 + key.1 + 1) / 2 + key.1) as u64;
@ -177,7 +177,7 @@ where
} }
// Returns elem by the key // Returns elem by the key
fn get_elem(&self, key: Key) -> PmtreeResult<H::Fr> { pub fn get_elem(&self, key: Key) -> PmtreeResult<H::Fr> {
let res = self let res = self
.db .db
.get(key.into())? .get(key.into())?