pub struct SyncRequest<I = ()> { /* private fields */ }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
chain_tip (if provided).
// Construct a sync request.
let sync_request = SyncRequest::builder()
// Provide chain tip of the local wallet.
.chain_tip(local_chain.tip())
// Provide list of scripts to scan for transactions against.
.spks(scripts)
// This is called for every synced item.
.inspect(|item, progress| println!("{} (remaining: {})", item, progress.remaining()))
// Finish constructing the sync request.
.build();Implementations§
Source§impl<I> SyncRequest<I>
impl<I> SyncRequest<I>
Sourcepub fn builder_at(start_time: u64) -> SyncRequestBuilder<I>
pub fn builder_at(start_time: u64) -> SyncRequestBuilder<I>
Start building SyncRequest with a given start_time.
start_time specifies the start time of sync. Chain sources can use this value to set
TxUpdate::seen_ats for mempool transactions. A transaction
without any seen_ats is assumed to be unseen in the mempool.
Use SyncRequest::builder to use the current timestamp as start_time (this requires
feature = "std").
Sourcepub fn builder() -> SyncRequestBuilder<I>
pub fn builder() -> SyncRequestBuilder<I>
Start building SyncRequest with the current timestamp as the start_time.
Use SyncRequest::builder_at to manually set the start_time, or if feature = "std"
is not available.
Sourcepub fn start_time(&self) -> u64
pub fn start_time(&self) -> u64
When the sync-request was initiated.
Sourcepub fn progress(&self) -> SyncProgress
pub fn progress(&self) -> SyncProgress
Get the SyncProgress of this request.
Sourcepub fn chain_tip(&self) -> Option<CheckPoint>
pub fn chain_tip(&self) -> Option<CheckPoint>
Get the chain tip CheckPoint of this request (if any).
Sourcepub fn next_spk_with_expected_txids(&mut self) -> Option<SpkWithExpectedTxids>
pub fn next_spk_with_expected_txids(&mut self) -> Option<SpkWithExpectedTxids>
Sourcepub fn next_outpoint(&mut self) -> Option<OutPoint>
pub fn next_outpoint(&mut self) -> Option<OutPoint>
Sourcepub fn iter_spks_with_expected_txids(
&mut self,
) -> impl ExactSizeIterator<Item = SpkWithExpectedTxids> + '_
pub fn iter_spks_with_expected_txids( &mut self, ) -> impl ExactSizeIterator<Item = SpkWithExpectedTxids> + '_
Sourcepub fn iter_txids(&mut self) -> impl ExactSizeIterator<Item = Txid> + '_
pub fn iter_txids(&mut self) -> impl ExactSizeIterator<Item = Txid> + '_
Iterate over Txids contained in this request.
Sourcepub fn iter_outpoints(&mut self) -> impl ExactSizeIterator<Item = OutPoint> + '_
pub fn iter_outpoints(&mut self) -> impl ExactSizeIterator<Item = OutPoint> + '_
Iterate over OutPoints contained in this request.