Fixes #17603 (together with #17824)
getbalances
is using the cache within GetAvailableCredit
under certain conditions here. For a wallet with avoid_reuse
activated this can lead to inconsistent reporting of used
transactions/balances between getbalances
and listunspent
as pointed out in #17603. When an address is reused before the first transaction is spending from this address, the cache is not updated even after the transaction is sent. This means the remaining outputs at the reused address are not showing up as used
in getbalances
.
With this change, any newly incoming transaction belonging to the wallet marks all the other outputs at the same address as dirty.