Struct primitives::block::CompactBlock
source · pub struct CompactBlock {
pub block_header: BlockHeader,
pub nonce: u64,
pub tx_short_ids: Vec<u8>,
pub reconstructed_txns: Vec<Option<Arc<SignedTransaction>>>,
}
Fields§
§block_header: BlockHeader
The block header
nonce: u64
The nonce for use in short id calculation
tx_short_ids: Vec<u8>
A list of tx short ids
reconstructed_txns: Vec<Option<Arc<SignedTransaction>>>
Store the txns reconstructed, None means not received
Implementations§
source§impl CompactBlock
impl CompactBlock
pub fn len(&self) -> usize
pub fn hash(&self) -> H256
pub fn get_shortid_key(header: &BlockHeader, nonce: &u64) -> (u64, u64)
sourcepub fn create_shortids(
transactions: &Vec<Arc<SignedTransaction>>,
k0: u64,
k1: u64
) -> Vec<u8> ⓘ
pub fn create_shortids( transactions: &Vec<Arc<SignedTransaction>>, k0: u64, k1: u64 ) -> Vec<u8> ⓘ
Compute Tx ShortId from hash
pub fn to_u16(v1: u8, v2: u8) -> u16
pub fn to_u32(v1: u8, v2: u8, v3: u8, v4: u8) -> u32
pub fn get_random_bytes(transaction_id: &H256, key1: u64, key2: u64) -> u16
pub fn get_decomposed_short_ids(&self) -> (Vec<u16>, Vec<u32>)
Trait Implementations§
source§impl Clone for CompactBlock
impl Clone for CompactBlock
source§fn clone(&self) -> CompactBlock
fn clone(&self) -> CompactBlock
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CompactBlock
impl Debug for CompactBlock
source§impl Decodable for CompactBlock
impl Decodable for CompactBlock
source§impl Encodable for CompactBlock
impl Encodable for CompactBlock
source§impl MallocSizeOf for CompactBlock
impl MallocSizeOf for CompactBlock
source§impl PartialEq for CompactBlock
impl PartialEq for CompactBlock
source§fn eq(&self, other: &CompactBlock) -> bool
fn eq(&self, other: &CompactBlock) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for CompactBlock
Auto Trait Implementations§
impl RefUnwindSafe for CompactBlock
impl Send for CompactBlock
impl Sync for CompactBlock
impl Unpin for CompactBlock
impl UnwindSafe for CompactBlock
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