Struct bdk_chain::spk_client::FullScanRequest
source · pub struct FullScanRequest<K> {
pub chain_tip: CheckPoint,
pub tx_cache: TxCache,
pub spks_by_keychain: BTreeMap<K, Box<dyn Iterator<Item = (u32, 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.
tx_cache: TxCache
Cache of full transactions, so the chain-source can avoid re-fetching.
spks_by_keychain: BTreeMap<K, Box<dyn Iterator<Item = (u32, ScriptBuf)> + Send>>
Iterators of script pubkeys indexed by the keychain index.
Implementations§
source§impl<K: Ord + Clone> FullScanRequest<K>
impl<K: Ord + Clone> FullScanRequest<K>
sourcepub fn from_chain_tip(chain_tip: CheckPoint) -> Self
pub fn from_chain_tip(chain_tip: CheckPoint) -> Self
Construct a new FullScanRequest
from a given chain_tip
.
sourcepub fn cache_txs<T>(self, full_txs: impl IntoIterator<Item = (Txid, T)>) -> Selfwhere
T: Into<Arc<Transaction>>,
pub fn cache_txs<T>(self, full_txs: impl IntoIterator<Item = (Txid, T)>) -> Selfwhere
T: Into<Arc<Transaction>>,
Add to the TxCache
held by the request.
This consumes the SyncRequest
and returns the updated one.
sourcepub fn cache_graph_txs<A>(self, graph: &TxGraph<A>) -> Self
pub fn cache_graph_txs<A>(self, graph: &TxGraph<A>) -> Self
Add all transactions from TxGraph
into the TxCache
.
This consumes the SyncRequest
and returns the updated one.
sourcepub fn from_keychain_txout_index(
chain_tip: CheckPoint,
index: &KeychainTxOutIndex<K>
) -> Selfwhere
K: Debug,
pub fn from_keychain_txout_index(
chain_tip: CheckPoint,
index: &KeychainTxOutIndex<K>
) -> Selfwhere
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
.
sourcepub fn set_spks_for_keychain(
self,
keychain: K,
spks: impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static>
) -> Self
pub fn set_spks_for_keychain(
self,
keychain: K,
spks: impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static>
) -> Self
Set the [Script
]s for a given keychain
.
This consumes the FullScanRequest
and returns the updated one.
sourcepub fn chain_spks_for_keychain(
self,
keychain: K,
spks: impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static>
) -> Self
pub fn chain_spks_for_keychain(
self,
keychain: K,
spks: impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static>
) -> Self
Chain on additional [Script
]s that will be synced against.
This consumes the FullScanRequest
and returns the updated one.
sourcepub fn inspect_spks_for_all_keychains(
self,
inspect: impl FnMut(K, u32, &Script) + Send + Sync + Clone + 'static
) -> Selfwhere
K: Send + 'static,
pub fn inspect_spks_for_all_keychains(
self,
inspect: impl FnMut(K, u32, &Script) + Send + Sync + Clone + 'static
) -> Selfwhere
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.
sourcepub fn inspect_spks_for_keychain(
self,
keychain: K,
inspect: impl FnMut(u32, &Script) + Send + Sync + 'static
) -> Selfwhere
K: Send + 'static,
pub fn inspect_spks_for_keychain(
self,
keychain: K,
inspect: impl FnMut(u32, &Script) + Send + Sync + 'static
) -> Selfwhere
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.