(&self, store: &MemoryStore)
| 404 | } |
| 405 | |
| 406 | pub fn find_gap(&self, store: &MemoryStore) -> Option<usize> { |
| 407 | // return None if this wallet has no history at all |
| 408 | let max_funded_index = self.max_funded_index?; |
| 409 | |
| 410 | Some(if self.is_wildcard { |
| 411 | (0..=max_funded_index) |
| 412 | .map(|derivation_index| self.derive_address(derivation_index)) |
| 413 | .fold((0, 0), |(curr_gap, max_gap), address| { |
| 414 | if store.has_history(&address.into()) { |
| 415 | (0, curr_gap.max(max_gap)) |
| 416 | } else { |
| 417 | (curr_gap + 1, max_gap) |
| 418 | } |
| 419 | }) |
| 420 | .1 |
| 421 | } else { |
| 422 | 0 |
| 423 | }) |
| 424 | } |
| 425 | |
| 426 | /// Get the bip32 origins of the public keys used at the provided index |
| 427 | pub fn bip32_origins(&self, index: u32) -> Vec<Bip32Origin> { |
no test coverage detected