pub struct OfferTree { /* private fields */ }Expand description
A perfect binary Merkle tree over offer leaves. height = log2(leaves.len()).
Implementations§
Source§impl OfferTree
impl OfferTree
Sourcepub fn build(leaves: Vec<Word>) -> Result<Self, TreeError>
pub fn build(leaves: Vec<Word>) -> Result<Self, TreeError>
Build a perfect binary tree over leaves. Errors unless the count is a nonzero power of
two of at most 2^MAX_TREE_HEIGHT - HashLib.offerTreeTypeHash reverts TreeTooHigh
above height 20, so a taller tree could never ratify.
Sourcepub fn from_entries<I, E>(
entries: I,
) -> Result<OfferTreeDescriptor, OfferTreeError>
pub fn from_entries<I, E>( entries: I, ) -> Result<OfferTreeDescriptor, OfferTreeError>
Assign canonical group ids, append protocol-zero padding, and build the Merkle tree.
Standalone offers each receive their own content-addressed group. Explicit
OfferGroup entries retain their shared group id.
pub fn height(&self) -> usize
pub fn root(&self) -> Word
Trait Implementations§
impl Eq for OfferTree
impl StructuralPartialEq for OfferTree
Auto Trait Implementations§
impl Freeze for OfferTree
impl RefUnwindSafe for OfferTree
impl Send for OfferTree
impl Sync for OfferTree
impl Unpin for OfferTree
impl UnsafeUnpin for OfferTree
impl UnwindSafe for OfferTree
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