Struct primitives::block::Block
source · pub struct Block {
pub block_header: BlockHeader,
pub transactions: Vec<Arc<SignedTransaction>>,
pub approximated_rlp_size: usize,
pub approximated_rlp_size_with_public: usize,
}
Expand description
A block, encoded as it is on the block chain.
Fields§
§block_header: BlockHeader
The header hash of this block.
transactions: Vec<Arc<SignedTransaction>>
The transactions in this block.
approximated_rlp_size: usize
Approximated rlp size of the block.
approximated_rlp_size_with_public: usize
Approximated rlp size of block with transaction public key.
Implementations§
source§impl Block
impl Block
pub fn new( block_header: BlockHeader, transactions: Vec<Arc<SignedTransaction>> ) -> Self
pub fn new_with_rlp_size( block_header: BlockHeader, transactions: Vec<Arc<SignedTransaction>>, rlp_size: Option<usize>, rlp_size_with_public: Option<usize> ) -> Self
pub fn hash(&self) -> H256
sourcepub fn approximated_rlp_size(&self) -> usize
pub fn approximated_rlp_size(&self) -> usize
Approximated rlp size of the block.
sourcepub fn approximated_rlp_size_with_public(&self) -> usize
pub fn approximated_rlp_size_with_public(&self) -> usize
Approximated rlp size of block with transaction public key.
pub fn total_gas(&self) -> U256
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
The size filled in the RPC response. It returns the approximate rlp size of the block.
pub fn transaction_hashes(&self, space_filter: Option<Space>) -> Vec<H256>
sourcepub fn to_compact(&self) -> CompactBlock
pub fn to_compact(&self) -> CompactBlock
Construct a new compact block with random nonce This block will be relayed with the new compact block to prevent adversaries to make tx shortId collision
pub fn encode_body_with_tx_public(&self) -> Vec<u8> ⓘ
pub fn decode_body_with_tx_public( rlp: &Rlp<'_> ) -> Result<Vec<Arc<SignedTransaction>>, DecoderError>
pub fn encode_with_tx_public(&self) -> Vec<u8> ⓘ
pub fn decode_with_tx_public(rlp: &Rlp<'_>) -> Result<Self, DecoderError>
Trait Implementations§
source§impl PartialEq for Block
impl PartialEq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations§
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