You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A shielded Clear that resets the tree but fails to purge leaves the balance reported as known #5988
After a shielded Clear has reset the commitment tree, no account's local balance is reported as established until a scan or a restore covers the new tree.
Current Behavior
NetworkShieldedCoordinator::clear resets the tree and then calls purge_all_subwallets. When the reset succeeds and the purge fails, the notes, watermarks and scan provenance stay in the store; Clear then clears hydration and returns the error.
local_balance_snapshot returns RestoreIncomplete for an unhydrated wallet only when an account's source is not ScannedThisSession. An account that completed a scan in this session therefore still reads Ready with its pre-Clear amount, against an emptied tree.
The same sequence is on v5.1-dev. With #5982 the balance emitter compares states, sees no change and sends nothing, so hosts keep showing the amount as known.
Possible Solution
On the failure path, invalidate scan provenance that predates the tree reset, while keeping the notes and the pending spend records. Cover it with a failed-Clear test that starts from an account with a completed scan.
Steps to Reproduce (for bugs)
Bind a wallet and complete a shielded scan, so the account's source is ScannedThisSession.
Run Clear so that the tree reset succeeds and purge_all_subwallets fails (for example the shielded_pending_spends delete fails).
Read local_balance_snapshot for the wallet.
It returns Ready with the pre-Clear amount.
Found in review of #5982 and confirmed by reading packages/rs-platform-wallet/src/wallet/shielded/coordinator.rs. Not reproduced in a test yet.
Context
Deferred from #5982: #5982 (comment). It needs a storage failure between the two steps of one Clear, and Clear already returns that error to the host, so it was left out of that pull request.
Activity