diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0961aebc7c9..b971be5ddda 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4085,7 +4085,11 @@ util::Result<void> CWallet::ApplyMigrationData(WalletBatch& local_wallet_batch, if (ExtractDestination(script, dest)) not_migrated_dests.emplace(dest); } - Assume(!m_cached_spks.empty()); + // When the legacy wallet has no spendable scripts, the main wallet will be empty, leaving its script cache empty as well. + // The watch-only and/or solvable wallet(s) will contain the scripts in their respective caches. + if (!data.desc_spkms.empty()) Assume(!m_cached_spks.empty()); + if (!data.watch_descs.empty()) Assume(!data.watchonly_wallet->m_cached_spks.empty()); + if (!data.solvable_descs.empty()) Assume(!data.solvable_wallet->m_cached_spks.empty()); for (auto& desc_spkm : data.desc_spkms) { if (m_spk_managers.count(desc_spkm->GetID()) > 0) {