Struct bdk_chain::spk_client::FullScanRequest

source ·
pub struct FullScanRequest<K> {
    pub chain_tip: CheckPoint,
    pub spks_by_keychain: BTreeMap<K, Box<dyn Iterator<Item = Indexed<ScriptBuf>> + Send>>,
}
Expand description

Data required to perform a spk-based blockchain client full scan.

A client full scan iterates through all the scripts for the given keychains, fetching relevant data until some stop gap number of scripts is found that have no data. This operation is generally only used when importing or restoring previously used keychains in which the list of used scripts is not known. The full scan process also updates the chain from the given CheckPoint.

Fields§

§chain_tip: CheckPoint

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

§spks_by_keychain: BTreeMap<K, Box<dyn Iterator<Item = Indexed<ScriptBuf>> + Send>>

Iterators of script pubkeys indexed by the keychain index.

Implementations§

source§

impl<K: Ord + Clone> FullScanRequest<K>

source

pub fn from_chain_tip(chain_tip: CheckPoint) -> Self

Construct a new FullScanRequest from a given chain_tip.

source

pub fn from_keychain_txout_index( chain_tip: CheckPoint, index: &KeychainTxOutIndex<K> ) -> Self
where K: Debug,

Construct a new FullScanRequest from a given chain_tip and index.

Unbounded script pubkey iterators for each keychain (K) are extracted using KeychainTxOutIndex::all_unbounded_spk_iters and is used to populate the FullScanRequest.

source

pub fn set_spks_for_keychain( self, keychain: K, spks: impl IntoIterator<IntoIter = impl Iterator<Item = Indexed<ScriptBuf>> + Send + 'static> ) -> Self

Set the [Script]s for a given keychain.

This consumes the FullScanRequest and returns the updated one.

source

pub fn chain_spks_for_keychain( self, keychain: K, spks: impl IntoIterator<IntoIter = impl Iterator<Item = Indexed<ScriptBuf>> + Send + 'static> ) -> Self

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

This consumes the FullScanRequest and returns the updated one.

source

pub fn inspect_spks_for_all_keychains( self, inspect: impl FnMut(K, u32, &Script) + Send + Sync + Clone + 'static ) -> Self
where K: Send + 'static,

Add a closure that will be called for every [Script] previously added to any keychain in this request.

This consumes the SyncRequest and returns the updated one.

source

pub fn inspect_spks_for_keychain( self, keychain: K, inspect: impl FnMut(u32, &Script) + Send + Sync + 'static ) -> Self
where K: Send + 'static,

Add a closure that will be called for every [Script] previously added to a given keychain in this request.

This consumes the SyncRequest and returns the updated one.

Auto Trait Implementations§

§

impl<K> Freeze for FullScanRequest<K>

§

impl<K> !RefUnwindSafe for FullScanRequest<K>

§

impl<K> Send for FullScanRequest<K>
where K: Send,

§

impl<K> !Sync for FullScanRequest<K>

§

impl<K> Unpin for FullScanRequest<K>

§

impl<K> !UnwindSafe for FullScanRequest<K>

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