Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pepper-sync/src/sync/transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,18 @@ pub(crate) async fn update_addresses_and_scan_targets<W: SyncWallet>(
.filter(|id| id.account_id() == *account_id && id.scope() == *scope)
.next_back()
{
id.address_index().index() + 1
id.address_index().next()
} else {
0
};
Some(NonHardenedChildIndex::ZERO)
}
.ok_or_else(|| {
SyncError::TransparentAddressDerivationError(bip32::Error::ChildNumber)
})?;
let mut unused_address_count: usize = 0;
let mut addresses: Vec<(TransparentAddressId, String)> = Vec::new();

while unused_address_count < config.gap_limit as usize {
let address_id = TransparentAddressId::new(
*account_id,
*scope,
NonHardenedChildIndex::from_index(address_index)
.expect("all non-hardened addresses in use!"),
);
let address_id = TransparentAddressId::new(*account_id, *scope, address_index);
let address = keys::transparent::derive_address(
consensus_parameters,
account_pubkey,
Expand Down Expand Up @@ -152,7 +150,9 @@ pub(crate) async fn update_addresses_and_scan_targets<W: SyncWallet>(
unused_address_count = 0;
}

address_index += 1;
address_index = address_index.next().ok_or_else(|| {
SyncError::TransparentAddressDerivationError(bip32::Error::ChildNumber)
})?;
}

addresses.truncate(addresses.len() - config.gap_limit as usize);
Expand Down
Loading