Struct bdk_chain::bitcoin::bip152::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§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
§fn eq(&self, other: &HeaderAndShortIds) -> bool
fn eq(&self, other: &HeaderAndShortIds) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for HeaderAndShortIds
impl PartialOrd for HeaderAndShortIds
§fn partial_cmp(&self, other: &HeaderAndShortIds) -> Option<Ordering>
fn partial_cmp(&self, other: &HeaderAndShortIds) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more