From 8222341d4f9c2b7c572b27dea16036d6ea372067 Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Thu, 15 May 2025 13:34:49 -0700 Subject: [PATCH] wallet: MarkDirty after AddWalletDescriptor After adding a wallet descriptor (typically by import), mark all balance caches dirty. This allows transactions that the wallet already knows about that have outputs that are now ISMINE_SPENDABLE after the import to actually be shown in balance calculations. Legacy wallet imports would do this, but importdescriptors did not. --- src/wallet/wallet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 991b138b85f..840d7d5bc94 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3735,6 +3735,9 @@ util::Result> CWallet::AddWall // Save the descriptor to DB spk_man->WriteDescriptor(); + // Break balance caches so that outputs that are now IsMine in already known txs will be included in the balance + MarkDirty(); + return std::reference_wrapper(*spk_man); }