pub struct HeaderAndShortIds {
pub header: BlockHeader,
pub nonce: u64,
pub short_ids: Vec<ShortId>,
pub prefilled_txs: Vec<PrefilledTransaction>,
}
Expand description
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: BlockHeader
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
sourceimpl HeaderAndShortIds
impl HeaderAndShortIds
sourcepub 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
sourceimpl Clone for HeaderAndShortIds
impl Clone for HeaderAndShortIds
sourcefn clone(&self) -> HeaderAndShortIds
fn clone(&self) -> HeaderAndShortIds
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for HeaderAndShortIds
impl Debug for HeaderAndShortIds
sourceimpl Decodable for HeaderAndShortIds
impl Decodable for HeaderAndShortIds
sourcefn consensus_decode_from_finite_reader<R: Read + ?Sized>(
r: &mut R
) -> Result<HeaderAndShortIds, Error>
fn consensus_decode_from_finite_reader<R: Read + ?Sized>(
r: &mut R
) -> Result<HeaderAndShortIds, Error>
Self
from a size-limited reader. Read moresourcefn consensus_decode<R: Read + ?Sized>(
r: &mut R
) -> Result<HeaderAndShortIds, Error>
fn consensus_decode<R: Read + ?Sized>(
r: &mut R
) -> Result<HeaderAndShortIds, Error>
sourceimpl Encodable for HeaderAndShortIds
impl Encodable for HeaderAndShortIds
sourceimpl Hash for HeaderAndShortIds
impl Hash for HeaderAndShortIds
sourceimpl Ord for HeaderAndShortIds
impl Ord for HeaderAndShortIds
sourcefn cmp(&self, other: &HeaderAndShortIds) -> Ordering
fn cmp(&self, other: &HeaderAndShortIds) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Selfwhere
Self: Sized,
const fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourceconst fn min(self, other: Self) -> Selfwhere
Self: Sized,
const fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialEq<HeaderAndShortIds> for HeaderAndShortIds
impl PartialEq<HeaderAndShortIds> for HeaderAndShortIds
sourcefn eq(&self, other: &HeaderAndShortIds) -> bool
fn eq(&self, other: &HeaderAndShortIds) -> bool
sourceimpl PartialOrd<HeaderAndShortIds> for HeaderAndShortIds
impl PartialOrd<HeaderAndShortIds> for HeaderAndShortIds
sourcefn partial_cmp(&self, other: &HeaderAndShortIds) -> Option<Ordering>
fn partial_cmp(&self, other: &HeaderAndShortIds) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more