diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-03-01 17:03:52 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-06-24 13:49:22 -0400 |
commit | 74fede3b8ba69e2cc82c617cdf406ab79df58825 (patch) | |
tree | 8d5e969d58e535cab4c7cbb7099f39dedf8154df /src/wallet/walletdb.cpp | |
parent | 432ba9e5434da90d2cf680f23e8c7b7164c9f945 (diff) | |
download | bitcoin-74fede3b8ba69e2cc82c617cdf406ab79df58825.tar.xz |
wallet: Upgrade existing descriptor caches
Add functions to upgrade existing descriptor caches to support the use
of last hardened xpub caching.
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r-- | src/wallet/walletdb.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 72b987d327..748cabe290 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -884,6 +884,14 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet) result = DBErrors::CORRUPT; } + // Upgrade all of the descriptor caches to cache the last hardened xpub + // This operation is not atomic, but if it fails, only new entries are added so it is backwards compatible + try { + pwallet->UpgradeDescriptorCache(); + } catch (...) { + result = DBErrors::CORRUPT; + } + // Set the inactive chain if (wss.m_hd_chains.size() > 0) { LegacyScriptPubKeyMan* legacy_spkm = pwallet->GetLegacyScriptPubKeyMan(); |