Struct HeaderAndShortIds
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§
§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§fn consensus_decode<R>(r: &mut R) -> Result<HeaderAndShortIds, Error>
fn consensus_decode<R>(r: &mut R) -> Result<HeaderAndShortIds, Error>
§impl Encodable for HeaderAndShortIds
impl Encodable for HeaderAndShortIds
§impl Hash for HeaderAndShortIds
impl Hash for HeaderAndShortIds
§impl Ord for HeaderAndShortIds
impl Ord for HeaderAndShortIds
§fn cmp(&self, other: &HeaderAndShortIds) -> Ordering
fn cmp(&self, other: &HeaderAndShortIds) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for HeaderAndShortIds
impl PartialEq for HeaderAndShortIds
§impl PartialOrd for HeaderAndShortIds
impl PartialOrd for HeaderAndShortIds
impl Eq for HeaderAndShortIds
impl StructuralPartialEq for HeaderAndShortIds
Auto Trait Implementations§
impl Freeze for HeaderAndShortIds
impl RefUnwindSafe for HeaderAndShortIds
impl Send for HeaderAndShortIds
impl Sync for HeaderAndShortIds
impl Unpin for HeaderAndShortIds
impl UnwindSafe for HeaderAndShortIds
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request