Once created, a SyncRequest cannott be inspected to know which spks will be synced. The inspect callback provides that information but only once the sync is already in motion and there is no way to query the request at rest.
Note that for Wallet users there is a workaround: wallet.spk_index().revealed_spks(..) gives the full list of spks, but this requires going back to the wallet rather than reading the already-constructed request, and is not available to callers working directly with bdk_core.
Proposed draft addition to SyncRequest:
pub fn iter_spks(&self) -> impl Iterator<Item = &(I, ScriptBuf)> {
self.spks.iter()
}
For symmetry, non-consuming iterators for txids and outpoints could be added at the same time, potentially with:
pub fn iter_txids(&self) -> impl Iterator<Item = &Txid> {
self.txids.iter()
}
pub fn iter_outpoints(&self) -> impl Iterator<Item = &OutPoint> {
self.outpoints.iter()
}
Note that counts for all three are already available via progress(). This issue proposes only to add access to the actual contents without consuming the request.
Impact
Are you using BDK in a production project?
Which backend(s) are relevant (if any)?
Once created, a
SyncRequestcannott be inspected to know which spks will be synced. The inspect callback provides that information but only once the sync is already in motion and there is no way to query the request at rest.Note that for
Walletusers there is a workaround:wallet.spk_index().revealed_spks(..)gives the full list of spks, but this requires going back to the wallet rather than reading the already-constructed request, and is not available to callers working directly with bdk_core.Proposed draft addition to
SyncRequest:For symmetry, non-consuming iterators for txids and outpoints could be added at the same time, potentially with:
Note that counts for all three are already available via progress(). This issue proposes only to add access to the actual contents without consuming the request.
Impact
Are you using BDK in a production project?
Which backend(s) are relevant (if any)?
bdk_chain,bdk_core)____