Skip to content

Commit

Permalink
Use leaf-node size (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle authored Nov 22, 2023
1 parent 4890286 commit ec8a2d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions firewood/src/merkle/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ mod leaf;
mod partial_path;

pub use branch::{BranchNode, MAX_CHILDREN, SIZE as BRANCH_NODE_SIZE};
pub use extension::{ExtNode, SIZE as EXTENSION_NODE_SIZE};
pub use leaf::LeafNode;
pub use extension::ExtNode;
pub use leaf::{LeafNode, SIZE as LEAF_NODE_SIZE};
pub use partial_path::PartialPath;

use crate::merkle::to_nibble_array;
Expand Down Expand Up @@ -89,7 +89,7 @@ impl NodeType {
let items: Vec<Encoded<Vec<u8>>> = bincode::DefaultOptions::new().deserialize(buf)?;

match items.len() {
EXTENSION_NODE_SIZE => {
LEAF_NODE_SIZE => {
let mut items = items.into_iter();

let decoded_key: Vec<u8> = items.next().unwrap().decode()?;
Expand Down
2 changes: 0 additions & 2 deletions firewood/src/merkle/node/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use crate::{
};
use std::fmt::{Debug, Error as FmtError, Formatter};

pub const SIZE: usize = 2;

#[derive(PartialEq, Eq, Clone)]
pub struct ExtNode {
pub(crate) path: PartialPath,
Expand Down
3 changes: 1 addition & 2 deletions firewood/src/merkle/node/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use bincode::Options;
use super::{Data, Encoded};
use crate::merkle::{from_nibbles, PartialPath};

// will be needed when extension node is removed
// pub const SIZE: usize = 2;
pub const SIZE: usize = 2;

#[derive(PartialEq, Eq, Clone)]
pub struct LeafNode {
Expand Down

0 comments on commit ec8a2d1

Please sign in to comment.