Remove max_addresses sync param

You can do this with ensure_addresses_cached if you really want to.
This commit is contained in:
LLFourn 2022-03-07 10:44:41 +11:00
parent d03aa85108
commit 45767fcaf7
No known key found for this signature in database
GPG Key ID: A27093B54DA11F65
2 changed files with 4 additions and 9 deletions

View File

@ -21,6 +21,7 @@ To decouple the `Wallet` from the `Blockchain` we've made major changes:
- Changed `Wallet::sync` to take a `Blockchain`. - Changed `Wallet::sync` to take a `Blockchain`.
- Stop making a request for the block height when calling `Wallet:new`. - Stop making a request for the block height when calling `Wallet:new`.
- Added `SyncOptions` to capture extra (future) arguments to `Wallet::sync`. - Added `SyncOptions` to capture extra (future) arguments to `Wallet::sync`.
- Removed `max_addresses` sync parameter which determined how many addresses to cache before syncing since this can just be done with `ensure_addreses_cached`.
## [v0.16.1] - [v0.16.0] ## [v0.16.1] - [v0.16.0]

View File

@ -163,8 +163,6 @@ impl fmt::Display for AddressInfo {
pub struct SyncOptions { pub struct SyncOptions {
/// The progress tracker which may be informed when progress is made. /// The progress tracker which may be informed when progress is made.
pub progress: Option<Box<dyn Progress>>, pub progress: Option<Box<dyn Progress>>,
/// The maximum number of new addresses to derive and cache on sync.
pub max_addresses: Option<u32>,
} }
impl<D> Wallet<D> impl<D> Wallet<D>
@ -1524,14 +1522,10 @@ where
) -> Result<(), Error> { ) -> Result<(), Error> {
debug!("Begin sync..."); debug!("Begin sync...");
let SyncOptions { let SyncOptions { progress } = sync_opts;
max_addresses,
progress,
} = sync_opts;
let progress = progress.unwrap_or_else(|| Box::new(NoopProgress)); let progress = progress.unwrap_or_else(|| Box::new(NoopProgress));
let run_setup = let run_setup = self.ensure_addresses_cached(CACHE_ADDR_BATCH_SIZE)?;
self.ensure_addresses_cached(max_addresses.unwrap_or(CACHE_ADDR_BATCH_SIZE))?;
debug!("run_setup: {}", run_setup); debug!("run_setup: {}", run_setup);
// TODO: what if i generate an address first and cache some addresses? // TODO: what if i generate an address first and cache some addresses?