wallet: incorrect total/locked balance displayed in UI (double-counting)
I've noticed swap funds are counted twice in Total wallet balance displayed in UI (and likely bond-locked as well?).
Digging through the relevant code a bit I think the following adjustments should resolve it - https://github.com/norwnd/dcrdex/pull/25/commits/730aea93b76acf4067cea0220cb2aef3e7fe23fd (it's a bit of a hurdle for me to create actual PR with the change - but feel free to borrow whatever code you see fit, and pls let me know if it's actually wrong).
Update:
It seems the issue goes a bit deeper, now with that commit from above I have my total Locked balance showing smaller value than what Swapping shows (so Swapping isn't actually included into Locked but rather is a part of Available) ...
I should note, the Swap transaction in question didn't get mined due to low fee (have been hanging for days) and now corresponding Match shows "Refund ... Will happen in the next few blocks" - which is a separate issue - the relevant part being Polygon wallet now seems to gave up on that Swap transaction and counts these funds as Available while these funds still show under locked for Swapping as well (which is technically correct since it's theoretically possible for that Swap transaction to get mined still unless I send another transaction with the same nonce - but displaying it in UI like that is confusing),
and so it seems the best way to resolve it would be to
- always count
Swapping&Bondedbalances asLocked(meaning, if it counts in one of those sections it should always be counted underLockedas well, and vice versa)
btw, (just note) it still counts those funds as Swapping even after I used that same Polygon nonce that would completely invalidate corresponding Swap transaction