pub struct WitnessMerkleNode(/* private fields */);Expand description
A hash corresponding to the Merkle tree root for witness data.
Implementations§
§impl WitnessMerkleNode
impl WitnessMerkleNode
pub const fn from_byte_array(bytes: [u8; 32]) -> Self
pub const fn from_byte_array(bytes: [u8; 32]) -> Self
Constructs a new type from the underlying byte array.
pub const fn to_byte_array(self) -> [u8; 32]
pub const fn to_byte_array(self) -> [u8; 32]
Returns the underlying byte array.
pub const fn as_byte_array(&self) -> &[u8; 32]
pub const fn as_byte_array(&self) -> &[u8; 32]
Returns a reference to the underlying byte array.
Source§impl WitnessMerkleNode
impl WitnessMerkleNode
Sourcepub fn combine(&self, other: &Self) -> Self
pub fn combine(&self, other: &Self) -> Self
Combine two nodes to get a single node. The final node of a tree is called the “root”.
Sourcepub fn calculate_root<I: Iterator<Item = Wtxid>>(iter: I) -> Option<Self>
pub fn calculate_root<I: Iterator<Item = Wtxid>>(iter: I) -> Option<Self>
Given an iterator of leaves, compute the Merkle root.
Returns None if the iterator was empty, or if the transaction list contains
consecutive duplicates which would trigger CVE 2012-2459. Blocks with duplicate
transactions will always be invalid, so there is no harm in us refusing to
compute their merkle roots.
Unless you are certain your transaction list is nonempty and has no duplicates,
you should not unwrap the Option returned by this method!
Trait Implementations§
§impl<'a> Arbitrary<'a> for WitnessMerkleNode
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for WitnessMerkleNode
Available on crate feature
arbitrary only.§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read more§impl AsRef<[u8]> for WitnessMerkleNode
impl AsRef<[u8]> for WitnessMerkleNode
§impl AsRef<[u8; 32]> for WitnessMerkleNode
impl AsRef<[u8; 32]> for WitnessMerkleNode
§impl Borrow<[u8]> for WitnessMerkleNode
impl Borrow<[u8]> for WitnessMerkleNode
§impl Borrow<[u8; 32]> for WitnessMerkleNode
impl Borrow<[u8; 32]> for WitnessMerkleNode
Source§impl Clone for WitnessMerkleNode
impl Clone for WitnessMerkleNode
Source§fn clone(&self) -> WitnessMerkleNode
fn clone(&self) -> WitnessMerkleNode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WitnessMerkleNode
impl Debug for WitnessMerkleNode
Source§impl Decodable for WitnessMerkleNode
impl Decodable for WitnessMerkleNode
§impl<'de> Deserialize<'de> for WitnessMerkleNode
impl<'de> Deserialize<'de> for WitnessMerkleNode
§fn deserialize<D: Deserializer<'de>>(
d: D,
) -> Result<WitnessMerkleNode, D::Error>
fn deserialize<D: Deserializer<'de>>( d: D, ) -> Result<WitnessMerkleNode, D::Error>
Deserialize this value from the given Serde deserializer. Read more
§impl Display for WitnessMerkleNode
Available on crate feature hex only.
impl Display for WitnessMerkleNode
Available on crate feature
hex only.Source§impl Encodable for WitnessMerkleNode
impl Encodable for WitnessMerkleNode
§impl FromStr for WitnessMerkleNode
Available on crate feature hex only.
impl FromStr for WitnessMerkleNode
Available on crate feature
hex only.Source§impl Hash for WitnessMerkleNode
impl Hash for WitnessMerkleNode
§impl LowerHex for WitnessMerkleNode
Available on crate feature hex only.
impl LowerHex for WitnessMerkleNode
Available on crate feature
hex only.Source§impl Ord for WitnessMerkleNode
impl Ord for WitnessMerkleNode
Source§fn cmp(&self, other: &WitnessMerkleNode) -> Ordering
fn cmp(&self, other: &WitnessMerkleNode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for WitnessMerkleNode
impl PartialEq for WitnessMerkleNode
Source§impl PartialOrd for WitnessMerkleNode
impl PartialOrd for WitnessMerkleNode
§impl Serialize for WitnessMerkleNode
impl Serialize for WitnessMerkleNode
§impl UpperHex for WitnessMerkleNode
Available on crate feature hex only.
impl UpperHex for WitnessMerkleNode
Available on crate feature
hex only.impl Copy for WitnessMerkleNode
impl Eq for WitnessMerkleNode
impl StructuralPartialEq for WitnessMerkleNode
Auto Trait Implementations§
impl Freeze for WitnessMerkleNode
impl RefUnwindSafe for WitnessMerkleNode
impl Send for WitnessMerkleNode
impl Sync for WitnessMerkleNode
impl Unpin for WitnessMerkleNode
impl UnsafeUnpin for WitnessMerkleNode
impl UnwindSafe for WitnessMerkleNode
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