pub struct InnerNode {
pub hash: Hash,
pub is_left_sibling: bool,
pub left: Arc<Node>,
pub right: Arc<Node>,
}
Expand description
Represents an inner node in the indexed Merkle Tree.
This structure is used for non-leaf nodes in the tree, containing references to its left and right children along with its own hash value. There is no difference between inner nodes of an indexed Merkle Tree and a classic Merkle Tree.
Fields:
hash
: The hash of the current node, derived from its children.is_left_sibling
: Indicates whether this node is a left child of its parent.left
: A reference-counted pointer to the left child node.right
: A reference-counted pointer to the right child node.
Fields§
§hash: Hash
§is_left_sibling: bool
§left: Arc<Node>
§right: Arc<Node>
Implementations§
Source§impl InnerNode
impl InnerNode
Sourcepub fn new(left: Node, right: Node, index: usize) -> Self
pub fn new(left: Node, right: Node, index: usize) -> Self
Creates a new inner node.
This function generates an inner node from two child nodes (left and right) and an index. The index determines the new node’s left sibling status. The hash for the inner node is calculated based on its children. This is crucial for constructing the tree and updating its structure.
§Arguments
left
- The left child node.right
- The right child node.index
- The position index of the new node in the tree.
§Returns
An InnerNode
representing the newly created inner node.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for InnerNode
impl<'de> Deserialize<'de> for InnerNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for InnerNode
impl StructuralPartialEq for InnerNode
Auto Trait Implementations§
impl Freeze for InnerNode
impl RefUnwindSafe for InnerNode
impl Send for InnerNode
impl Sync for InnerNode
impl Unpin for InnerNode
impl UnwindSafe for InnerNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more