pub struct Block {
pub header: BlockHeader,
pub txdata: Vec<Transaction>,
}Expand description
A Bitcoin block, which is a collection of transactions with an attached proof of work.
Fields§
§header: BlockHeaderThe block header
txdata: Vec<Transaction>List of transactions contained in the block
Implementations§
Source§impl Block
impl Block
Sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Return the block hash.
Sourcepub fn check_merkle_root(&self) -> bool
pub fn check_merkle_root(&self) -> bool
check 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
check if witness commitment in coinbase is matching the transaction list
Sourcepub fn merkle_root(&self) -> TxMerkleNode
pub fn merkle_root(&self) -> TxMerkleNode
Calculate the transaction merkle root.
Sourcepub fn compute_witness_commitment(
witness_root: &WitnessMerkleNode,
witness_reserved_value: &[u8],
) -> WitnessCommitment
pub fn compute_witness_commitment( witness_root: &WitnessMerkleNode, witness_reserved_value: &[u8], ) -> WitnessCommitment
compute witness commitment for the transaction list
Sourcepub fn witness_root(&self) -> WitnessMerkleNode
pub fn witness_root(&self) -> WitnessMerkleNode
Merkle root of transactions hashed for witness
Sourcepub fn get_weight(&self) -> usize
pub fn get_weight(&self) -> usize
Get the weight of the block
Sourcepub fn coinbase(&self) -> Option<&Transaction>
pub fn coinbase(&self) -> Option<&Transaction>
Get 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>
Get the block height as encoded into the coinbase according to BIP34. Returns None if not present.
Trait Implementations§
impl Eq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
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