@@ -3433,6 +3433,29 @@ void CWallet::LoadDescriptorScriptPubKeyMan(uint256 id, WalletDescriptor& desc)
3433
3433
}
3434
3434
}
3435
3435
3436
+ void CWallet::SetupDescriptorScriptPubKeyMans (const CExtKey& master_key)
3437
+ {
3438
+ AssertLockHeld (cs_wallet);
3439
+
3440
+ for (bool internal : {false , true }) {
3441
+ for (OutputType t : OUTPUT_TYPES) {
3442
+ auto spk_manager = std::unique_ptr<DescriptorScriptPubKeyMan>(new DescriptorScriptPubKeyMan (*this ));
3443
+ if (IsCrypted ()) {
3444
+ if (IsLocked ()) {
3445
+ throw std::runtime_error (std::string (__func__) + " : Wallet is locked, cannot setup new descriptors" );
3446
+ }
3447
+ if (!spk_manager->CheckDecryptionKey (vMasterKey) && !spk_manager->Encrypt (vMasterKey, nullptr )) {
3448
+ throw std::runtime_error (std::string (__func__) + " : Could not encrypt new descriptors" );
3449
+ }
3450
+ }
3451
+ spk_manager->SetupDescriptorGeneration (master_key, t, internal);
3452
+ uint256 id = spk_manager->GetID ();
3453
+ m_spk_managers[id] = std::move (spk_manager);
3454
+ AddActiveScriptPubKeyMan (id, t, internal);
3455
+ }
3456
+ }
3457
+ }
3458
+
3436
3459
void CWallet::SetupDescriptorScriptPubKeyMans ()
3437
3460
{
3438
3461
AssertLockHeld (cs_wallet);
@@ -3448,23 +3471,7 @@ void CWallet::SetupDescriptorScriptPubKeyMans()
3448
3471
CExtKey master_key;
3449
3472
master_key.SetSeed (seed_key);
3450
3473
3451
- for (bool internal : {false , true }) {
3452
- for (OutputType t : OUTPUT_TYPES) {
3453
- auto spk_manager = std::unique_ptr<DescriptorScriptPubKeyMan>(new DescriptorScriptPubKeyMan (*this ));
3454
- if (IsCrypted ()) {
3455
- if (IsLocked ()) {
3456
- throw std::runtime_error (std::string (__func__) + " : Wallet is locked, cannot setup new descriptors" );
3457
- }
3458
- if (!spk_manager->CheckDecryptionKey (vMasterKey) && !spk_manager->Encrypt (vMasterKey, nullptr )) {
3459
- throw std::runtime_error (std::string (__func__) + " : Could not encrypt new descriptors" );
3460
- }
3461
- }
3462
- spk_manager->SetupDescriptorGeneration (master_key, t, internal);
3463
- uint256 id = spk_manager->GetID ();
3464
- m_spk_managers[id] = std::move (spk_manager);
3465
- AddActiveScriptPubKeyMan (id, t, internal);
3466
- }
3467
- }
3474
+ SetupDescriptorScriptPubKeyMans (master_key);
3468
3475
} else {
3469
3476
ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner ();
3470
3477
0 commit comments