Skip to content

Commit 5bf7725

Browse files
committed
refactor(electrum_ext): rename scan to scan_with_keychain and scan_without_keychain to scan
1 parent f741122 commit 5bf7725

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

crates/electrum/src/electrum_ext.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub trait ElectrumExt {
146146
/// The 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 scan_with_keychain<K: Ord + Clone>(
150150
&self,
151151
prev_tip: CheckPoint,
152152
keychain_spks: BTreeMap<K, impl IntoIterator<Item = (u32, ScriptBuf)>>,
@@ -156,10 +156,10 @@ 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+
/// Convenience method to call [`scan_with_keychain`] without requiring a keychain.
160160
///
161-
/// [`scan`]: ElectrumExt::scan
162-
fn scan_without_keychain(
161+
/// [`scan_with_keychain`]: ElectrumExt::scan_with_keychain
162+
fn scan(
163163
&self,
164164
prev_tip: CheckPoint,
165165
misc_spks: impl IntoIterator<Item = ScriptBuf>,
@@ -172,7 +172,7 @@ pub trait ElectrumExt {
172172
.enumerate()
173173
.map(|(i, spk)| (i as u32, spk));
174174

175-
let (electrum_update, _) = self.scan(
175+
let (electrum_update, _) = self.scan_with_keychain(
176176
prev_tip,
177177
[((), spk_iter)].into(),
178178
txids,
@@ -186,7 +186,7 @@ pub trait ElectrumExt {
186186
}
187187

188188
impl ElectrumExt for Client {
189-
fn scan<K: Ord + Clone>(
189+
fn scan_with_keychain<K: Ord + Clone>(
190190
&self,
191191
prev_tip: CheckPoint,
192192
keychain_spks: BTreeMap<K, impl IntoIterator<Item = (u32, ScriptBuf)>>,

crates/electrum/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This crate is used for updating structures of the [`bdk_chain`] crate with data from electrum.
22
//!
3-
//! The star of the show is the [`ElectrumExt::scan`] method, which scans for relevant blockchain
3+
//! The star of the show is the [`ElectrumExt::scan_with_keychain`] method, which scans for relevant blockchain
44
//! data (via electrum) and outputs updates for [`bdk_chain`] structures as a tuple of form:
55
//!
66
//! ([`bdk_chain::local_chain::Update`], [`RelevantTxids`], `keychain_update`)

example-crates/example_electrum/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ fn main() -> anyhow::Result<()> {
172172
};
173173

174174
client
175-
.scan(
175+
.scan_with_keychain(
176176
tip,
177177
keychain_spks,
178178
core::iter::empty(),
@@ -279,7 +279,7 @@ fn main() -> anyhow::Result<()> {
279279
drop((graph, chain));
280280

281281
let electrum_update = client
282-
.scan_without_keychain(tip, spks, txids, outpoints, scan_options.batch_size)
282+
.scan(tip, spks, txids, outpoints, scan_options.batch_size)
283283
.context("scanning the blockchain")?;
284284
(electrum_update, BTreeMap::new())
285285
}

example-crates/wallet_electrum/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn main() -> Result<(), anyhow::Error> {
6161
relevant_txids,
6262
},
6363
keychain_update,
64-
) = client.scan(prev_tip, keychain_spks, None, None, STOP_GAP, BATCH_SIZE)?;
64+
) = client.scan_with_keychain(prev_tip, keychain_spks, None, None, STOP_GAP, BATCH_SIZE)?;
6565

6666
println!();
6767

0 commit comments

Comments
 (0)