pub fn generate_gap_addresses<DbT, SE>(
wallet_db: &mut DbT,
gap_limits: &GapLimits,
account_id: <DbT as AddressStore>::AccountRef,
account_uivk: &UnifiedIncomingViewingKey,
account_ufvk: Option<&UnifiedFullViewingKey>,
key_scope: TransparentKeyScope,
request: UnifiedAddressRequest,
require_key: bool,
) -> Result<(), GapAddressesError<SE>>where
DbT: AddressStore<Error = SE>,transparent-inputs only.Expand description
Generates transparent addresses to fill the gap for a given account and key scope.
This function queries the wallet backend (via AddressStore) to find the start
of the first gap of unused addresses, then generates enough addresses to maintain the
configured gap limit. If no gap exists (i.e., the address space is exhausted), this is a
no-op.
Each window of addresses is checked against previously observed transaction involvement via
AddressStore::reconcile_stored_addresses, and a window in which that check finds an
address used moves the gap, so a further window is derived and checked in turn. This
continues until a window is checked without moving the gap. The gap start is read afresh
each round, and the next round runs only if it lies beyond the highest address the previous
round found used. That address lies within the previous window, so the gap start strictly
increases; the non-hardened child index space is finite, so the number of rounds is bounded.