@@ -306,8 +306,6 @@ pub enum LoadError {
306306 MissingNetwork ,
307307 /// Data loaded from persistence is missing genesis hash.
308308 MissingGenesis ,
309- /// Data loaded from persistence is missing descriptor.
310- MissingDescriptor ,
311309}
312310
313311impl fmt:: Display for LoadError {
@@ -320,7 +318,6 @@ impl fmt::Display for LoadError {
320318 }
321319 LoadError :: MissingNetwork => write ! ( f, "loaded data is missing network type" ) ,
322320 LoadError :: MissingGenesis => write ! ( f, "loaded data is missing genesis hash" ) ,
323- LoadError :: MissingDescriptor => write ! ( f, "loaded data is missing descriptor" ) ,
324321 }
325322 }
326323}
@@ -359,8 +356,7 @@ pub enum NewOrLoadError {
359356 /// The loaded desccriptor does not match what was provided.
360357 LoadedDescriptorDoesNotMatch {
361358 /// The descriptor loaded from persistence.
362- // TODO: this doesn't need to be Option. both external/internal are persisted
363- got : Option < ExtendedDescriptor > ,
359+ got : ExtendedDescriptor ,
364360 /// The keychain of the descriptor not matching
365361 keychain : KeychainKind ,
366362 } ,
@@ -582,14 +578,14 @@ impl Wallet {
582578 . indexer
583579 . keychains_added
584580 . get ( & KeychainKind :: External )
585- . ok_or ( LoadError :: MissingDescriptor ) ?
581+ . expect ( "keychain must have been added" )
586582 . clone ( ) ;
587583 let change_descriptor = changeset
588584 . indexed_tx_graph
589585 . indexer
590586 . keychains_added
591587 . get ( & KeychainKind :: Internal )
592- . ok_or ( LoadError :: MissingDescriptor ) ?
588+ . expect ( "keychain must have been added" )
593589 . clone ( ) ;
594590
595591 let ( signers, change_signers) =
@@ -661,10 +657,6 @@ impl Wallet {
661657 expected : genesis_hash,
662658 got : None ,
663659 } ,
664- LoadError :: MissingDescriptor => NewOrLoadError :: LoadedDescriptorDoesNotMatch {
665- got : None ,
666- keychain : KeychainKind :: External ,
667- } ,
668660 } ) ?;
669661 if wallet. network != network {
670662 return Err ( NewOrLoadError :: LoadedNetworkDoesNotMatch {
@@ -685,7 +677,7 @@ impl Wallet {
685677 let wallet_descriptor = wallet. public_descriptor ( KeychainKind :: External ) ;
686678 if wallet_descriptor != & expected_descriptor {
687679 return Err ( NewOrLoadError :: LoadedDescriptorDoesNotMatch {
688- got : Some ( wallet_descriptor. clone ( ) ) ,
680+ got : wallet_descriptor. clone ( ) ,
689681 keychain : KeychainKind :: External ,
690682 } ) ;
691683 }
@@ -712,7 +704,7 @@ impl Wallet {
712704 let wallet_change_descriptor = wallet. public_descriptor ( KeychainKind :: Internal ) ;
713705 if wallet_change_descriptor != & expected_change_descriptor {
714706 return Err ( NewOrLoadError :: LoadedDescriptorDoesNotMatch {
715- got : Some ( wallet_change_descriptor. clone ( ) ) ,
707+ got : wallet_change_descriptor. clone ( ) ,
716708 keychain : KeychainKind :: Internal ,
717709 } ) ;
718710 }
0 commit comments