Struct HeaderAndShortIds
pub struct HeaderAndShortIds {
pub header: Header,
pub nonce: u64,
pub short_ids: Vec<ShortId>,
pub prefilled_txs: Vec<PrefilledTransaction>,
}
Expand description
A structure to relay a block header, short IDs, and a select few transactions.
A HeaderAndShortIds structure is used to relay a block header, the short transactions IDs used for matching already-available transactions, and a select few transactions which we expect a peer may be missing.
Fields§
§header: Header
The header of the block being provided.
nonce: u64
A nonce for use in short transaction ID calculations.
short_ids: Vec<ShortId>
The short transaction IDs calculated from the transactions which were not provided explicitly in prefilled_txs.
prefilled_txs: Vec<PrefilledTransaction>
Used to provide the coinbase transaction and a select few which we expect a peer may be missing.
Implementations§
§impl HeaderAndShortIds
impl HeaderAndShortIds
pub fn from_block(
block: &Block,
nonce: u64,
version: u32,
prefill: &[usize],
) -> Result<HeaderAndShortIds, Error>
pub fn from_block( block: &Block, nonce: u64, version: u32, prefill: &[usize], ) -> Result<HeaderAndShortIds, Error>
Create a new HeaderAndShortIds from a full block.
The version number must be either 1 or 2.
The prefill
slice indicates which transactions should be prefilled in
the block. It should contain the indexes in the block of the txs to
prefill. It must be ordered. 0 should not be included as the
coinbase tx is always prefilled.
Nodes SHOULD NOT use the same nonce across multiple different blocks.
Trait Implementations§
§impl Clone for HeaderAndShortIds
impl Clone for HeaderAndShortIds
§fn clone(&self) -> HeaderAndShortIds
fn clone(&self) -> HeaderAndShortIds
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for HeaderAndShortIds
impl Debug for HeaderAndShortIds
§impl Decodable for HeaderAndShortIds
impl Decodable for HeaderAndShortIds
§fn consensus_decode_from_finite_reader<R>(
r: &mut R,
) -> Result<HeaderAndShortIds, Error>
fn consensus_decode_from_finite_reader<R>( r: &mut R, ) -> Result<HeaderAndShortIds, Error>
Self
from a size-limited reader. Read more