Struct nostr_sdk::bitcoin::bip152::HeaderAndShortIds
pub struct HeaderAndShortIds {
pub header: Header,
pub nonce: u64,
pub short_ids: Vec<ShortId, Global>,
pub prefilled_txs: Vec<PrefilledTransaction, Global>,
}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: HeaderThe header of the block being provided.
nonce: u64A nonce for use in short transaction ID calculations.
short_ids: Vec<ShortId, Global>The short transaction IDs calculated from the transactions which were not provided explicitly in prefilled_txs.
prefilled_txs: Vec<PrefilledTransaction, Global>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>where
R: Read + ?Sized,
fn consensus_decode_from_finite_reader<R>( r: &mut R ) -> Result<HeaderAndShortIds, Error>where R: Read + ?Sized,
Self from a size-limited reader. Read more§fn consensus_decode<R>(r: &mut R) -> Result<HeaderAndShortIds, Error>where
R: Read + ?Sized,
fn consensus_decode<R>(r: &mut R) -> Result<HeaderAndShortIds, Error>where R: Read + ?Sized,
§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<HeaderAndShortIds> for HeaderAndShortIds
impl PartialEq<HeaderAndShortIds> 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<HeaderAndShortIds> for HeaderAndShortIds
impl PartialOrd<HeaderAndShortIds> 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 moreimpl Eq for HeaderAndShortIds
impl StructuralEq for HeaderAndShortIds
impl StructuralPartialEq for HeaderAndShortIds
Auto Trait Implementations§
impl RefUnwindSafe for HeaderAndShortIds
impl Send for HeaderAndShortIds
impl Sync for HeaderAndShortIds
impl Unpin for HeaderAndShortIds
impl UnwindSafe for HeaderAndShortIds
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.