pub struct ReadBlock { /* private fields */ }Implementations§
Source§impl ReadBlock
impl ReadBlock
pub fn metadata(&self) -> &BlkMetadata
pub fn tx_metadata(&self) -> &Vec<BlkMetadata>
pub fn inner(self) -> Block
Methods from Deref<Target = Block>§
pub fn height(&self) -> Height
pub fn hash(&self) -> &BlockHash
Sourcepub fn total_size_and_weight(&self) -> (usize, usize)
pub fn total_size_and_weight(&self) -> (usize, usize)
Compute total_size and weight in a single pass (2N tx serializations
instead of 3N from calling total_size() + weight() separately,
since weight() internally calls both base_size() and total_size()).
Sourcepub fn compute_tx_id_and_sizes(&self, index: usize) -> (Txid, u32, u32)
pub fn compute_tx_id_and_sizes(&self, index: usize) -> (Txid, u32, u32)
Compute txid, base_size, and total_size for the transaction at index.
Uses raw bytes (fast path) when available, falls back to re-serialization.
pub fn coinbase_tag(&self) -> Cow<'_, str>
Methods from Deref<Target = Block>§
Sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Returns the block hash.
Sourcepub fn check_merkle_root(&self) -> bool
pub fn check_merkle_root(&self) -> bool
Checks if merkle root of header matches merkle root of the transaction list.
Sourcepub fn check_witness_commitment(&self) -> bool
pub fn check_witness_commitment(&self) -> bool
Checks if witness commitment in coinbase matches the transaction list.
Sourcepub fn compute_merkle_root(&self) -> Option<TxMerkleNode>
pub fn compute_merkle_root(&self) -> Option<TxMerkleNode>
Computes the transaction merkle root.
Sourcepub fn witness_root(&self) -> Option<WitnessMerkleNode>
pub fn witness_root(&self) -> Option<WitnessMerkleNode>
Computes the merkle root of transactions hashed for witness.
Sourcepub fn weight(&self) -> Weight
pub fn weight(&self) -> Weight
Returns the weight of the block.
Block weight is defined as Base size * 3 + Total size.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Returns the total block size.
Total size is the block size in bytes with transactions serialized as described in BIP144, including base data and witness data.
Sourcepub fn coinbase(&self) -> Option<&Transaction>
pub fn coinbase(&self) -> Option<&Transaction>
Returns the coinbase transaction, if one is present.
Sourcepub fn bip34_block_height(&self) -> Result<u64, Bip34Error>
pub fn bip34_block_height(&self) -> Result<u64, Bip34Error>
Returns the block height, as encoded in the coinbase transaction according to BIP34.
Trait Implementations§
Source§impl From<(Block, BlkMetadata, Vec<BlkMetadata>)> for ReadBlock
impl From<(Block, BlkMetadata, Vec<BlkMetadata>)> for ReadBlock
Source§fn from(
(block, metadata, tx_metadata): (Block, BlkMetadata, Vec<BlkMetadata>),
) -> Self
fn from( (block, metadata, tx_metadata): (Block, BlkMetadata, Vec<BlkMetadata>), ) -> Self
Auto Trait Implementations§
impl Freeze for ReadBlock
impl RefUnwindSafe for ReadBlock
impl Send for ReadBlock
impl Sync for ReadBlock
impl Unpin for ReadBlock
impl UnsafeUnpin for ReadBlock
impl UnwindSafe for ReadBlock
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more