| 613 | } |
| 614 | |
| 615 | bool CWallet::Unlock(const SecureString& strWalletPassphrase) |
| 616 | { |
| 617 | CKeyingMaterial plain_master_key; |
| 618 | |
| 619 | { |
| 620 | LOCK(cs_wallet); |
| 621 | for (const auto& [_, master_key] : mapMasterKeys) |
| 622 | { |
| 623 | if (!DecryptMasterKey(strWalletPassphrase, master_key, plain_master_key)) { |
| 624 | continue; // try another master key |
| 625 | } |
| 626 | if (Unlock(plain_master_key)) { |
| 627 | // Now that we've unlocked, upgrade the descriptor cache |
| 628 | UpgradeDescriptorCache(); |
| 629 | return true; |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | return false; |
| 634 | } |
| 635 | |
| 636 | bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase) |
| 637 | { |