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.
This commit is contained in:
Ava Chow
2025-05-15 13:34:49 -07:00
parent e02f2d331c
commit 8222341d4f

View File

@@ -3735,6 +3735,9 @@ util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> 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);
}