wallet: Recompute wallet TXOs after descriptor migration

When a legacy wallet has been migrated to contain descriptors, but
before the transactions have been updated to match, we need to recompute
the wallet TXOs so that the transaction update will work correctly.
This commit is contained in:
Ava Chow
2024-02-20 11:50:11 -05:00
parent 764016eb22
commit 17d453cb3a

View File

@@ -3901,6 +3901,10 @@ util::Result<void> CWallet::ApplyMigrationData(WalletBatch& local_wallet_batch,
return util::Error{_("Error: Unable to read wallet's best block locator record")};
}
// Update m_txos to match the descriptors remaining in this wallet
m_txos.clear();
RefreshAllTXOs();
// Check if the transactions in the wallet are still ours. Either they belong here, or they belong in the watchonly wallet.
// We need to go through these in the tx insertion order so that lookups to spends works.
std::vector<Txid> txids_to_delete;