Skip to content

Commit c81f8df

Browse files
committed
wallet: Set upgraded descriptor cache flag for newly created wallets
Although WalletBatch::LoadWallet performs the descriptor cache upgrade, because new wallets do not have the descriptor flag set yet, the upgrade does not run and set the flag. Since new wallets will always being using the upgraded cache, there's no reason to wait to set the flag, so set it when the wallet flags are being initialized for new wallets.
1 parent c556c28 commit c81f8df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2895,7 +2895,9 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
28952895
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key
28962896
walletInstance->SetMinVersion(FEATURE_LATEST);
28972897

2898-
walletInstance->InitWalletFlags(wallet_creation_flags);
2898+
// Init with passed flags.
2899+
// Always set the cache upgrade flag as this feature is supported from the beginning.
2900+
walletInstance->InitWalletFlags(wallet_creation_flags | WALLET_FLAG_LAST_HARDENED_XPUB_CACHED);
28992901

29002902
// Only descriptor wallets can be created
29012903
assert(walletInstance->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));

0 commit comments

Comments
 (0)