@@ -3754,21 +3754,28 @@ void CWallet::SetupDescriptorScriptPubKeyMans(const CExtKey& master_key)
3754
3754
if (!batch.TxnCommit ()) throw std::runtime_error (" Error: cannot commit db transaction for descriptors setup" );
3755
3755
}
3756
3756
3757
- void CWallet::SetupDescriptorScriptPubKeyMans ()
3757
+ void CWallet::SetupOwnDescriptorScriptPubKeyMans ()
3758
3758
{
3759
3759
AssertLockHeld (cs_wallet);
3760
+ assert (!IsWalletFlagSet (WALLET_FLAG_EXTERNAL_SIGNER));
3761
+ // Make a seed
3762
+ CKey seed_key = GenerateRandomKey ();
3763
+ CPubKey seed = seed_key.GetPubKey ();
3764
+ assert (seed_key.VerifyPubKey (seed));
3760
3765
3761
- if (!IsWalletFlagSet (WALLET_FLAG_EXTERNAL_SIGNER)) {
3762
- // Make a seed
3763
- CKey seed_key = GenerateRandomKey ();
3764
- CPubKey seed = seed_key.GetPubKey ();
3765
- assert (seed_key.VerifyPubKey (seed));
3766
+ // Get the extended key
3767
+ CExtKey master_key;
3768
+ master_key.SetSeed (seed_key);
3766
3769
3767
- // Get the extended key
3768
- CExtKey master_key;
3769
- master_key.SetSeed (seed_key);
3770
+ SetupDescriptorScriptPubKeyMans (master_key);
3771
+ }
3770
3772
3771
- SetupDescriptorScriptPubKeyMans (master_key);
3773
+ void CWallet::SetupDescriptorScriptPubKeyMans ()
3774
+ {
3775
+ AssertLockHeld (cs_wallet);
3776
+
3777
+ if (!IsWalletFlagSet (WALLET_FLAG_EXTERNAL_SIGNER)) {
3778
+ SetupOwnDescriptorScriptPubKeyMans ();
3772
3779
} else {
3773
3780
ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner ();
3774
3781
@@ -4102,7 +4109,7 @@ bool CWallet::ApplyMigrationData(MigrationData& data, bilingual_str& error)
4102
4109
SetupDescriptorScriptPubKeyMans (data.master_key );
4103
4110
} else {
4104
4111
// Setup with a new seed if we don't.
4105
- SetupDescriptorScriptPubKeyMans ();
4112
+ SetupOwnDescriptorScriptPubKeyMans ();
4106
4113
}
4107
4114
}
4108
4115
0 commit comments