Struct InflightBlock

Source
pub(crate) struct InflightBlock {
    pub peer: u32,
    pub block: Block,
    pub aux_data: Option<(Vec<CompactLeafData>, Proof, u32)>,
}
Expand description

A block that is currently being downloaded or pending processing

To download a block, we first request the block itself, and then we request the proof and leaf data for it. This struct holds the data we already have. We may also keep it around, as we may receive blocks out of order, so while we wait for the previous blocks to finish download, we keep the blocks that are already downloaded as an InflightBlock.

Fields§

§peer: u32

The peer that sent the block.

§block: Block

The block itself.

§aux_data: Option<(Vec<CompactLeafData>, Proof, u32)>

Auxiliary data needed for validating this block. Currently, it includes utreexo leaf data (previous UTXOs spent in the block), the corresponding accumulator inclusion proof, and the peer id that provided them.

Implementations§

Source§

impl InflightBlock

Source

fn new(block: Block, peer: u32) -> Self

Creates a new InflightBlock from a block and the associated peer id.

If the block doesn’t spend any output (i.e., coinbase transaction only) this method adds empty auxiliary data, which marks this inflight block as ready to process. Blocks with transactions require UtreexoData (see InflightBlock::add_utreexo_data).

Source

fn add_utreexo_data( &mut self, leaf_data: Vec<CompactLeafData>, proof: Proof, peer: u32, )

Attaches the auxiliary utreexo data to this InflightBlock.

Trait Implementations§

Source§

impl Debug for InflightBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more