Skip to content

Conversation

@f321x
Copy link
Member

@f321x f321x commented Jan 7, 2026

There was a race incorrectly counting transactions with one
confirmations to the unconfirmed balance instead of the confirmed
balance (in the pie chart and the qml total balance shown above the history).

This happened because the balance cache of AddressSynchronizer got
invalidated after on_event_blockchain_updated and then again after
receive_history_callback->add_transaction, however when calling
AddressSynchronizer.get_balance() before the tx got spv verified the
height would still be counted as 0 (unconfirmed), populating the balance
cache again with the unconfirmed balance.

I noticed this only on QML due to timing differences to Qt.
Invalidating the cache in AddressSynchronizer.add_verified_tx() after
the tx got verified causes the balance to get recalculated and shown
correctly.

f321x added 2 commits January 7, 2026 16:36
This loop seems like a leftover that is not useful anymore, clearing the
cache once has the same effect.
There was a race incorrectly counting transactions with one
confirmations to the unconfirmed balance instead of the confirmed
balance.
This happened because the balance cache of AddressSynchronizer got
invalidated after `on_event_blockchain_updated` and then again after
`receive_history_callback`->`add_transaction`, however when calling
`AddressSynchronizer.get_balance()` before the tx got spv verified the
height would still be counted as 0 (unconfirmed), populating the balance
cache again with the unconfirmed balance.
I noticed this only on QML due to timing differences to Qt.
Invalidating the cache in `AddressSynchronizer.add_verified_tx()` after
the tx got verified causes the balance to get recalculated and shown
correctly.
@f321x f321x added this to the 4.7.0 milestone Jan 7, 2026
@f321x f321x added the bug 🐞 label Jan 7, 2026
@ecdsa ecdsa merged commit dac507e into spesmilo:master Jan 9, 2026
16 checks passed
@f321x f321x deleted the fix_qml_balance branch January 9, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants