From 5bf772517ceaa4ad347b853aa7060b4e7c137e06 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 6 Dec 2023 21:14:16 -0600 Subject: [PATCH] refactor(electrum_ext): rename scan to scan_with_keychain and scan_without_keychain to scan --- crates/electrum/src/electrum_ext.rs | 12 ++++++------ crates/electrum/src/lib.rs | 2 +- example-crates/example_electrum/src/main.rs | 4 ++-- example-crates/wallet_electrum/src/main.rs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/electrum/src/electrum_ext.rs b/crates/electrum/src/electrum_ext.rs index e54007cd93..592d95a843 100644 --- a/crates/electrum/src/electrum_ext.rs +++ b/crates/electrum/src/electrum_ext.rs @@ -146,7 +146,7 @@ pub trait ElectrumExt { /// The scan for each keychain stops after a gap of `stop_gap` script pubkeys with no associated /// transactions. `batch_size` specifies the max number of script pubkeys to request for in a /// single batch request. - fn scan( + fn scan_with_keychain( &self, prev_tip: CheckPoint, keychain_spks: BTreeMap>, @@ -156,10 +156,10 @@ pub trait ElectrumExt { batch_size: usize, ) -> Result<(ElectrumUpdate, BTreeMap), Error>; - /// Convenience method to call [`scan`] without requiring a keychain. + /// Convenience method to call [`scan_with_keychain`] without requiring a keychain. /// - /// [`scan`]: ElectrumExt::scan - fn scan_without_keychain( + /// [`scan_with_keychain`]: ElectrumExt::scan_with_keychain + fn scan( &self, prev_tip: CheckPoint, misc_spks: impl IntoIterator, @@ -172,7 +172,7 @@ pub trait ElectrumExt { .enumerate() .map(|(i, spk)| (i as u32, spk)); - let (electrum_update, _) = self.scan( + let (electrum_update, _) = self.scan_with_keychain( prev_tip, [((), spk_iter)].into(), txids, @@ -186,7 +186,7 @@ pub trait ElectrumExt { } impl ElectrumExt for Client { - fn scan( + fn scan_with_keychain( &self, prev_tip: CheckPoint, keychain_spks: BTreeMap>, diff --git a/crates/electrum/src/lib.rs b/crates/electrum/src/lib.rs index 1e4805379c..2e27c4e28b 100644 --- a/crates/electrum/src/lib.rs +++ b/crates/electrum/src/lib.rs @@ -1,6 +1,6 @@ //! This crate is used for updating structures of the [`bdk_chain`] crate with data from electrum. //! -//! The star of the show is the [`ElectrumExt::scan`] method, which scans for relevant blockchain +//! The star of the show is the [`ElectrumExt::scan_with_keychain`] method, which scans for relevant blockchain //! data (via electrum) and outputs updates for [`bdk_chain`] structures as a tuple of form: //! //! ([`bdk_chain::local_chain::Update`], [`RelevantTxids`], `keychain_update`) diff --git a/example-crates/example_electrum/src/main.rs b/example-crates/example_electrum/src/main.rs index a96378f647..86e81e4e78 100644 --- a/example-crates/example_electrum/src/main.rs +++ b/example-crates/example_electrum/src/main.rs @@ -172,7 +172,7 @@ fn main() -> anyhow::Result<()> { }; client - .scan( + .scan_with_keychain( tip, keychain_spks, core::iter::empty(), @@ -279,7 +279,7 @@ fn main() -> anyhow::Result<()> { drop((graph, chain)); let electrum_update = client - .scan_without_keychain(tip, spks, txids, outpoints, scan_options.batch_size) + .scan(tip, spks, txids, outpoints, scan_options.batch_size) .context("scanning the blockchain")?; (electrum_update, BTreeMap::new()) } diff --git a/example-crates/wallet_electrum/src/main.rs b/example-crates/wallet_electrum/src/main.rs index 9d4c6c5a4f..2608e0c826 100644 --- a/example-crates/wallet_electrum/src/main.rs +++ b/example-crates/wallet_electrum/src/main.rs @@ -61,7 +61,7 @@ fn main() -> Result<(), anyhow::Error> { relevant_txids, }, keychain_update, - ) = client.scan(prev_tip, keychain_spks, None, None, STOP_GAP, BATCH_SIZE)?; + ) = client.scan_with_keychain(prev_tip, keychain_spks, None, None, STOP_GAP, BATCH_SIZE)?; println!();