Struct bdk_chain::spk_client::SyncRequest
source · 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() -> SyncRequestBuilder<I>
pub fn builder() -> SyncRequestBuilder<I>
Start building a SyncRequest
.
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_outpoint(&mut self) -> Option<OutPoint>
pub fn next_outpoint(&mut self) -> Option<OutPoint>
sourcepub fn iter_spks(&mut self) -> impl ExactSizeIterator
pub fn iter_spks(&mut self) -> impl ExactSizeIterator
Iterate over ScriptBuf
s contained in this request.
sourcepub fn iter_txids(&mut self) -> impl ExactSizeIterator
pub fn iter_txids(&mut self) -> impl ExactSizeIterator
Iterate over Txid
s contained in this request.
sourcepub fn iter_outpoints(&mut self) -> impl ExactSizeIterator
pub fn iter_outpoints(&mut self) -> impl ExactSizeIterator
Iterate over OutPoint
s contained in this request.
Trait Implementations§
source§impl<I> Default for SyncRequest<I>
impl<I> Default for SyncRequest<I>
source§fn default() -> SyncRequest<I>
fn default() -> SyncRequest<I>
Returns the “default value” for a type. Read more
source§impl<I> From<SyncRequestBuilder<I>> for SyncRequest<I>
impl<I> From<SyncRequestBuilder<I>> for SyncRequest<I>
source§fn from(builder: SyncRequestBuilder<I>) -> SyncRequest<I>
fn from(builder: SyncRequestBuilder<I>) -> SyncRequest<I>
Converts to this type from the input type.
Auto Trait Implementations§
impl<I> Freeze for SyncRequest<I>
impl<I = ()> !RefUnwindSafe for SyncRequest<I>
impl<I> Send for SyncRequest<I>where
I: Send,
impl<I = ()> !Sync for SyncRequest<I>
impl<I> Unpin for SyncRequest<I>where
I: Unpin,
impl<I = ()> !UnwindSafe for SyncRequest<I>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more