@@ -134,19 +134,19 @@ pub struct ElectrumUpdate {
134134
135135/// Trait to extend [`Client`] functionality.
136136pub trait ElectrumExt {
137- /// Scan the blockchain (via electrum) for the data specified and returns updates for
138- /// [`bdk_chain`] data structures.
137+ /// Full scan the keychain scripts specified with the blockchain (via an Electrum client) and
138+ /// returns updates for [`bdk_chain`] data structures.
139139 ///
140140 /// - `prev_tip`: the most recent blockchain tip present locally
141141 /// - `keychain_spks`: keychains that we want to scan transactions for
142142 /// - `txids`: transactions for which we want updated [`Anchor`]s
143143 /// - `outpoints`: transactions associated with these outpoints (residing, spending) that we
144144 /// want to included in the update
145145 ///
146- /// The scan for each keychain stops after a gap of `stop_gap` script pubkeys with no associated
146+ /// The full scan for each keychain stops after a gap of `stop_gap` script pubkeys with no associated
147147 /// transactions. `batch_size` specifies the max number of script pubkeys to request for in a
148148 /// single batch request.
149- fn scan < K : Ord + Clone > (
149+ fn full_scan < K : Ord + Clone > (
150150 & self ,
151151 prev_tip : CheckPoint ,
152152 keychain_spks : BTreeMap < K , impl IntoIterator < Item = ( u32 , ScriptBuf ) > > ,
@@ -156,10 +156,23 @@ pub trait ElectrumExt {
156156 batch_size : usize ,
157157 ) -> Result < ( ElectrumUpdate , BTreeMap < K , u32 > ) , Error > ;
158158
159- /// Convenience method to call [`scan`] without requiring a keychain.
159+ /// Sync a set of scripts with the blockchain (via an Electrum client) for the data specified
160+ /// and returns updates for [`bdk_chain`] data structures.
160161 ///
161- /// [`scan`]: ElectrumExt::scan
162- fn scan_without_keychain (
162+ /// - `prev_tip`: the most recent blockchain tip present locally
163+ /// - `misc_spks`: an iterator of scripts we want to sync transactions for
164+ /// - `txids`: transactions for which we want updated [`Anchor`]s
165+ /// - `outpoints`: transactions associated with these outpoints (residing, spending) that we
166+ /// want to included in the update
167+ ///
168+ /// `batch_size` specifies the max number of script pubkeys to request for in a single batch
169+ /// request.
170+ ///
171+ /// If the scripts to sync are unknown, such as when restoring or importing a keychain that
172+ /// may include scripts that have been used, use [`full_scan`] with the keychain.
173+ ///
174+ /// [`full_scan`]: ElectrumExt::full_scan
175+ fn sync (
163176 & self ,
164177 prev_tip : CheckPoint ,
165178 misc_spks : impl IntoIterator < Item = ScriptBuf > ,
@@ -172,7 +185,7 @@ pub trait ElectrumExt {
172185 . enumerate ( )
173186 . map ( |( i, spk) | ( i as u32 , spk) ) ;
174187
175- let ( electrum_update, _) = self . scan (
188+ let ( electrum_update, _) = self . full_scan (
176189 prev_tip,
177190 [ ( ( ) , spk_iter) ] . into ( ) ,
178191 txids,
@@ -186,7 +199,7 @@ pub trait ElectrumExt {
186199}
187200
188201impl ElectrumExt for Client {
189- fn scan < K : Ord + Clone > (
202+ fn full_scan < K : Ord + Clone > (
190203 & self ,
191204 prev_tip : CheckPoint ,
192205 keychain_spks : BTreeMap < K , impl IntoIterator < Item = ( u32 , ScriptBuf ) > > ,
0 commit comments