Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add change output to wallet balance immediately #8073

Closed
woodser opened this issue Nov 20, 2021 · 7 comments · Fixed by #8158
Closed

Add change output to wallet balance immediately #8073

woodser opened this issue Nov 20, 2021 · 7 comments · Fixed by #8158

Comments

@woodser
Copy link
Contributor

woodser commented Nov 20, 2021

When a user spends XMR, their wallet spends outputs and creates a change output.

Currently, the wallet does not add the change output to the wallet's balance until confirmed.

As a result, the balance decreases by more than the amount spent, which is alarming to users.

This issue requests that the wallet adds the change output into its balance immediately so only the spend amount is deducted from the balance.

@woodser woodser changed the title Recognize change output as belonging to the wallet Add change output to wallet balance immediately Nov 20, 2021
@notmike-5
Copy link

@woodser but it wouldn't really be an accurate reflection of things would it? What if the transaction failed for some reason? Then there needs to be additional code to remove the amount that was incorrectly added to the balance. There are other reasons to prefer the way things are here, as well. A user should not be alarmed at the wallet working as intended.

@woodser
Copy link
Contributor Author

woodser commented Dec 17, 2021

@notmike-5 Currently the outgoing amount is deducted from the wallet balance immediately and re-added if the transaction fails. Unconfirmed payments are also credited to the balance immediately with this PR merged to master. This issue goes along the same line of thinking, requesting that the change output be treated equal to the other incoming and outgoing amounts. Otherwise, why treat it differently? Doing so creates an incorrect balance whether the transaction fails or not.

@woodser
Copy link
Contributor Author

woodser commented Dec 17, 2021

Also, the user's balance reducing by more than they sent is an alarming part of the experience. Adding change at the same time as subtracting the withdraw fixes that.

@rottenwheel
Copy link

@woodser So, is this merged and we're all good for it to be part of forthcoming v15 network upgrade, or?

See: #6986

@woodser
Copy link
Contributor Author

woodser commented Jan 22, 2022

This issue doesn't have an associated PR to my knowledge.

#6986 is merged into master, but it's not part of the v0.17.3.x release yet. Perhaps I should open a PR to the release-v0.17 branch? (@selsta?)

@woodser
Copy link
Contributor Author

woodser commented Jan 25, 2022

If I'm not mistaken, unconfirmed change is already credited to the balance immediately: https://github.com/woodser/monero/blob/67be0552e769a8322fc92afa5cbc187216f2b8f7/src/wallet/wallet2.cpp#L6045

I opened a PR to also credit unconfirmed transfers back to the same wallet immediately: #8158

When used with #6986, the unconfirmed balance should be correct with unconfirmed transfers and change.

@selsta
Copy link
Collaborator

selsta commented Jan 25, 2022

@woodser if you want something in the next release please also open it against release branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants