@@ -346,8 +346,6 @@ pub struct AddressPool {
346346 pub highest_generated : Option < u32 > ,
347347 /// Highest used index
348348 pub highest_used : Option < u32 > ,
349- /// Lookahead window for performance
350- pub lookahead_size : u32 ,
351349 /// Address type preference
352350 pub address_type : AddressType ,
353351}
@@ -389,7 +387,6 @@ impl AddressPool {
389387 used_indices : HashSet :: new ( ) ,
390388 highest_generated : None ,
391389 highest_used : None ,
392- lookahead_size : gap_limit * 2 ,
393390 address_type : AddressType :: P2pkh ,
394391 }
395392 }
@@ -899,23 +896,6 @@ impl AddressPool {
899896 Ok ( new_addresses)
900897 }
901898
902- /// Generate lookahead addresses for performance
903- pub fn generate_lookahead ( & mut self , key_source : & KeySource ) -> Result < Vec < Address > > {
904- let target = match self . highest_used {
905- None => self . lookahead_size ,
906- Some ( highest) => highest + self . lookahead_size + 1 ,
907- } ;
908-
909- let mut new_addresses = Vec :: new ( ) ;
910- while self . highest_generated . unwrap_or ( 0 ) < target {
911- let next_index = self . highest_generated . map ( |h| h + 1 ) . unwrap_or ( 0 ) ;
912- let address = self . generate_address_at_index ( next_index, key_source, true ) ?;
913- new_addresses. push ( address) ;
914- }
915-
916- Ok ( new_addresses)
917- }
918-
919899 /// Set a custom label for an address
920900 pub fn set_address_label ( & mut self , address : & Address , label : String ) -> bool {
921901 if let Some ( info) = self . address_info_mut ( address) {
@@ -1040,7 +1020,6 @@ pub struct AddressPoolBuilder {
10401020 pool_type : AddressPoolType ,
10411021 gap_limit : u32 ,
10421022 network : Network ,
1043- lookahead_size : u32 ,
10441023 address_type : AddressType ,
10451024 key_source : Option < KeySource > ,
10461025}
@@ -1053,7 +1032,6 @@ impl AddressPoolBuilder {
10531032 pool_type : AddressPoolType :: External ,
10541033 gap_limit : DEFAULT_EXTERNAL_GAP_LIMIT ,
10551034 network : Network :: Dash ,
1056- lookahead_size : 40 ,
10571035 address_type : AddressType :: P2pkh ,
10581036 key_source : None ,
10591037 }
@@ -1093,12 +1071,6 @@ impl AddressPoolBuilder {
10931071 self
10941072 }
10951073
1096- /// Set the lookahead size
1097- pub fn lookahead ( mut self , size : u32 ) -> Self {
1098- self . lookahead_size = size;
1099- self
1100- }
1101-
11021074 /// Set the address type
11031075 pub fn address_type ( mut self , addr_type : AddressType ) -> Self {
11041076 self . address_type = addr_type;
@@ -1122,7 +1094,6 @@ impl AddressPoolBuilder {
11221094 self . gap_limit ,
11231095 self . network ,
11241096 ) ;
1125- pool. lookahead_size = self . lookahead_size ;
11261097 pool. address_type = self . address_type ;
11271098
11281099 // Generate addresses if a key source was provided
@@ -1281,15 +1252,13 @@ mod tests {
12811252 . internal ( true )
12821253 . gap_limit ( 10 )
12831254 . network ( Network :: Testnet )
1284- . lookahead ( 20 )
12851255 . address_type ( AddressType :: P2pkh )
12861256 . build ( )
12871257 . unwrap ( ) ;
12881258
12891259 assert ! ( pool. is_internal( ) ) ;
12901260 assert_eq ! ( pool. gap_limit, 10 ) ;
12911261 assert_eq ! ( pool. network, Network :: Testnet ) ;
1292- assert_eq ! ( pool. lookahead_size, 20 ) ;
12931262 }
12941263
12951264 #[ test]
0 commit comments