Struct bdk_chain::spk_client::SyncRequest

source ·
pub struct SyncRequest {
    pub chain_tip: CheckPoint,
    pub spks: Box<dyn ExactSizeIterator<Item = ScriptBuf> + Send>,
    pub txids: Box<dyn ExactSizeIterator<Item = Txid> + Send>,
    pub outpoints: Box<dyn ExactSizeIterator<Item = OutPoint> + Send>,
}
Expand description

Data required to perform a spk-based blockchain client sync.

A client sync fetches relevant chain data for a known list of scripts, transaction ids and outpoints. The sync process also updates the chain from the given CheckPoint.

Fields§

§chain_tip: CheckPoint

A checkpoint for the current chain LocalChain::tip. The sync process will return a new chain update that extends this tip.

§spks: Box<dyn ExactSizeIterator<Item = ScriptBuf> + Send>

Transactions that spend from or to these indexed script pubkeys.

§txids: Box<dyn ExactSizeIterator<Item = Txid> + Send>

Transactions with these txids.

§outpoints: Box<dyn ExactSizeIterator<Item = OutPoint> + Send>

Transactions with these outpoints or spent from these outpoints.

Implementations§

source§

impl SyncRequest

source

pub fn from_chain_tip(cp: CheckPoint) -> Self

Construct a new SyncRequest from a given cp tip.

source

pub fn set_spks( self, spks: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = ScriptBuf> + Send + 'static> ) -> Self

Set the [Script]s that will be synced against.

This consumes the SyncRequest and returns the updated one.

source

pub fn set_txids( self, txids: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = Txid> + Send + 'static> ) -> Self

Set the [Txid]s that will be synced against.

This consumes the SyncRequest and returns the updated one.

source

pub fn set_outpoints( self, outpoints: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = OutPoint> + Send + 'static> ) -> Self

Set the [OutPoint]s that will be synced against.

This consumes the SyncRequest and returns the updated one.

source

pub fn chain_spks( self, spks: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = ScriptBuf> + Send + 'static, Item = ScriptBuf> ) -> Self

Chain on additional [Script]s that will be synced against.

This consumes the SyncRequest and returns the updated one.

source

pub fn chain_txids( self, txids: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = Txid> + Send + 'static, Item = Txid> ) -> Self

Chain on additional [Txid]s that will be synced against.

This consumes the SyncRequest and returns the updated one.

source

pub fn chain_outpoints( self, outpoints: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = OutPoint> + Send + 'static, Item = OutPoint> ) -> Self

Chain on additional [OutPoint]s that will be synced against.

This consumes the SyncRequest and returns the updated one.

source

pub fn inspect_spks( self, inspect: impl FnMut(&Script) + Send + Sync + 'static ) -> Self

Add a closure that will be called for [Script]s previously added to this request.

This consumes the SyncRequest and returns the updated one.

source

pub fn inspect_txids( self, inspect: impl FnMut(&Txid) + Send + Sync + 'static ) -> Self

Add a closure that will be called for [Txid]s previously added to this request.

This consumes the SyncRequest and returns the updated one.

source

pub fn inspect_outpoints( self, inspect: impl FnMut(&OutPoint) + Send + Sync + 'static ) -> Self

Add a closure that will be called for [OutPoint]s previously added to this request.

This consumes the SyncRequest and returns the updated one.

source

pub fn populate_with_revealed_spks<K: Clone + Ord + Debug + Send + Sync>( self, index: &KeychainTxOutIndex<K>, spk_range: impl RangeBounds<K> ) -> Self

Populate the request with revealed script pubkeys from index with the given spk_range.

This consumes the SyncRequest and returns the updated one.

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.

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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