@@ -219,12 +219,12 @@ pub struct KeychainTxOutIndex<K> {
219219 // a keychain, we return it with the highest-ranked keychain with it. We rank keychains by
220220 // `Ord`, therefore the keychain set is a `BTreeSet`. The earliest keychain variant (according
221221 // to `Ord`) has precedence.
222- descriptor_ids_to_keychains : HashMap < DescriptorId , BTreeSet < K > > ,
222+ keychains : HashMap < DescriptorId , BTreeSet < K > > ,
223223 // descriptor_id -> descriptor map
224224 // This is a "monotone" map, meaning that its size keeps growing, i.e., we never delete
225225 // descriptors from it. This is useful for revealing spks for descriptors that don't have
226226 // keychains associated.
227- descriptor_ids_to_descriptors : BTreeMap < DescriptorId , Descriptor < DescriptorPublicKey > > ,
227+ descriptors : BTreeMap < DescriptorId , Descriptor < DescriptorPublicKey > > ,
228228 // last revealed indexes
229229 last_revealed : BTreeMap < DescriptorId , u32 > ,
230230 // lookahead settings for each keychain
@@ -246,7 +246,7 @@ impl<K: Clone + Ord + Debug> Indexer for KeychainTxOutIndex<K> {
246246 // We want to reveal spks for descriptors that aren't tracked by any keychain, and
247247 // so we call reveal with descriptor_id
248248 let desc = self
249- . descriptor_ids_to_descriptors
249+ . descriptors
250250 . get ( & descriptor_id)
251251 . cloned ( )
252252 . expect ( "descriptors are added monotonically, scanned txout descriptor ids must have associated descriptors" ) ;
@@ -299,8 +299,8 @@ impl<K> KeychainTxOutIndex<K> {
299299 Self {
300300 inner : SpkTxOutIndex :: default ( ) ,
301301 keychains_to_descriptor_ids : BTreeMap :: new ( ) ,
302- descriptor_ids_to_keychains : HashMap :: new ( ) ,
303- descriptor_ids_to_descriptors : BTreeMap :: new ( ) ,
302+ keychains : HashMap :: new ( ) ,
303+ descriptors : BTreeMap :: new ( ) ,
304304 last_revealed : BTreeMap :: new ( ) ,
305305 lookahead,
306306 }
@@ -311,7 +311,7 @@ impl<K> KeychainTxOutIndex<K> {
311311impl < K : Clone + Ord + Debug > KeychainTxOutIndex < K > {
312312 /// Get the highest-ranked keychain that is currently associated with the given `desc_id`.
313313 fn keychain_of_desc_id ( & self , desc_id : & DescriptorId ) -> Option < & K > {
314- let keychains = self . descriptor_ids_to_keychains . get ( desc_id) ?;
314+ let keychains = self . keychains . get ( desc_id) ?;
315315 keychains. iter ( ) . next ( )
316316 }
317317
@@ -473,7 +473,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
473473 {
474474 self . keychains_to_descriptor_ids . iter ( ) . map ( |( k, desc_id) | {
475475 let descriptor = self
476- . descriptor_ids_to_descriptors
476+ . descriptors
477477 . get ( desc_id)
478478 . expect ( "descriptor id cannot be associated with keychain without descriptor" ) ;
479479 ( k, descriptor)
@@ -510,18 +510,18 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
510510 // is designed to track one descriptor per keychain (however different keychains can
511511 // share the same descriptor)
512512 let _is_keychain_removed = self
513- . descriptor_ids_to_keychains
513+ . keychains
514514 . get_mut ( & old_desc_id)
515515 . expect ( "we must have already inserted this descriptor" )
516516 . remove ( & keychain) ;
517517 debug_assert ! ( _is_keychain_removed) ;
518518 }
519519
520- self . descriptor_ids_to_keychains
520+ self . keychains
521521 . entry ( desc_id)
522522 . or_default ( )
523523 . insert ( keychain. clone ( ) ) ;
524- self . descriptor_ids_to_descriptors
524+ self . descriptors
525525 . insert ( desc_id, descriptor. clone ( ) ) ;
526526 self . replenish_lookahead ( & keychain, self . lookahead ) ;
527527
@@ -537,7 +537,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
537537 self . keychains_to_descriptor_ids
538538 . get ( keychain)
539539 . map ( |desc_id| {
540- self . descriptor_ids_to_descriptors
540+ self . descriptors
541541 . get ( desc_id)
542542 . expect ( "descriptor id cannot be associated with keychain without descriptor" )
543543 } )
@@ -571,7 +571,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
571571 let descriptor_id = self . keychains_to_descriptor_ids . get ( keychain) . copied ( ) ;
572572 if let Some ( descriptor_id) = descriptor_id {
573573 let descriptor = self
574- . descriptor_ids_to_descriptors
574+ . descriptors
575575 . get ( & descriptor_id)
576576 . expect ( "descriptor id cannot be associated with keychain without descriptor" ) ;
577577
@@ -606,7 +606,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
606606 ) -> Option < SpkIterator < Descriptor < DescriptorPublicKey > > > {
607607 let desc_id = self . keychains_to_descriptor_ids . get ( keychain) ?;
608608 let desc = self
609- . descriptor_ids_to_descriptors
609+ . descriptors
610610 . get ( desc_id)
611611 . cloned ( )
612612 . expect ( "descriptor id cannot be associated with keychain without descriptor" ) ;
@@ -621,7 +621,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
621621 . iter ( )
622622 . map ( |( k, desc_id) | {
623623 let desc = self
624- . descriptor_ids_to_descriptors
624+ . descriptors
625625 . get ( desc_id)
626626 . cloned ( )
627627 . expect ( "descriptor id cannot be associated with keychain without descriptor" ) ;
@@ -712,7 +712,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
712712 pub fn next_index ( & self , keychain : & K ) -> Option < ( u32 , bool ) > {
713713 let descriptor_id = self . keychains_to_descriptor_ids . get ( keychain) ?;
714714 let descriptor = self
715- . descriptor_ids_to_descriptors
715+ . descriptors
716716 . get ( descriptor_id)
717717 . expect ( "descriptor id cannot be associated with keychain without descriptor" ) ;
718718 Some ( self . next_index_with_descriptor ( descriptor) )
@@ -872,7 +872,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
872872 None => return ( None , ChangeSet :: default ( ) ) ,
873873 } ;
874874 let desc = self
875- . descriptor_ids_to_descriptors
875+ . descriptors
876876 . get ( descriptor_id)
877877 . cloned ( )
878878 . expect ( "descriptors are added monotonically, scanned txout descriptor ids must have associated descriptors" ) ;
@@ -901,7 +901,7 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
901901 }
902902 } ;
903903 let descriptor = self
904- . descriptor_ids_to_descriptors
904+ . descriptors
905905 . get ( & descriptor_id)
906906 . expect ( "descriptor id cannot be associated with keychain without descriptor" ) ;
907907 let ( next_index, _) = self . next_index_with_descriptor ( descriptor) ;
0 commit comments