pub struct Block {
pub header: BlockHeader,
pub transactions: Vec<SignedTransaction>,
}Expand description
A complete block on Tenzro Network
Contains the header and all transactions included in the block.
The transactions vector is bounded by MAX_DESERIALIZED_TX_COUNT
at deserialization time to protect against OOM via untrusted payloads
(HIGH #69 in the production audit).
Fields§
§header: BlockHeaderThe block header
transactions: Vec<SignedTransaction>All transactions in this block
Implementations§
Source§impl Block
impl Block
Sourcepub fn new(header: BlockHeader, transactions: Vec<SignedTransaction>) -> Self
pub fn new(header: BlockHeader, transactions: Vec<SignedTransaction>) -> Self
Creates a new block
Sourcepub fn new_validated(
header: BlockHeader,
transactions: Vec<SignedTransaction>,
) -> Result<Self, TenzroError>
pub fn new_validated( header: BlockHeader, transactions: Vec<SignedTransaction>, ) -> Result<Self, TenzroError>
Creates a new block with validation
Returns an error if the number of transactions exceeds MAX_TRANSACTIONS_PER_BLOCK
Sourcepub fn height(&self) -> BlockHeight
pub fn height(&self) -> BlockHeight
Returns the height of the block
Sourcepub fn validate_structure(&self) -> bool
pub fn validate_structure(&self) -> bool
Validates the block structure
Checks basic invariants like transaction count matching metadata.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Block
impl<'de> Deserialize<'de> for Block
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 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 UnsafeUnpin 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