-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
wallet2: remove refresh() from scan_tx #9389
Conversation
Are there any changes necessary to monero-gui? |
Nope EDIT: double checking |
Fixed a one line issue in the test.
When you restore a wallet in the GUI with the latest restore height, you have to wait until it downloads block hashes before you can scan a tx anyway (source). FWIW downloading block hashes is slow and unnecessary in this case, and is worth a change, but it's not a necessary change for this PR. I also just tested restore at current height + scan a tx in the GUI using this PR and it behaved the same as without this PR, with no changes to the GUI code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@j-berman please rebase |
ping regarding rebase @j-berman |
6ad9f68
to
98decee
Compare
Inconsistent test failure since merge: https://github.com/monero-project/monero/actions/runs/12918481913/job/36027874548#step:9:1463. @j-berman can you look into this? |
Fixes #9354
The problem
In #8566, I introduced a call to
refresh()
insidescan_tx
so that whenscan_tx
executes to completion, wallet data would reflect the latest chain state (e.g. the number of confirmations on the tx/tx's locked status would be up to date). I also introduced a new variablem_skip_to_height
to skip the wallet's refresh height to the tx's height if it hasn't synced to that height yet. The logic form_skip_to_height
mirrors the logic when a user includes a restore height when restoring the wallet.When refresh "skips" to
m_skip_to_height
(or a user restores a wallet at a provided restore height), the wallet downloads every block hash from the chain even from beforem_skip_to_height
(or provided restore height), which is (suspiciously) slow.Thus, when restoring a wallet and then calling
scan_tx
with a remote daemon,scan_tx
is slow to complete.The solution
This PR includes a simple fix to remove the call to
refresh()
insidescan_tx
.The other additional changes are there to ensure when
scan_tx
is called twice when the wallet is not yet synced to the height of txs scanned, those txs are reprocessed correctly (necessary change for this PR becausescan_tx
doesn't callrefresh()
anymore).Warning: when calling
scan_tx
when the wallet is not synced, the num confirmation data and locked status on scanned txs will not reflect the latest chain state with this change. A wallet must callrefresh
afterscan_tx
to get the latest state. Pinging @woodser on this since this reverts to behavior noted here.Misc. comment
@woodser suggested here to use the daemon's state to calculate things like num confirmations/locked status on a wallet's outputs, rather than use the wallet's latest sync state.
There are quite a few places where the wallet currently uses wallet state instead of daemon state. So it's a bit involved to decide exactly where daemon state should be used that won't break current wallet UX.
I'm proposing this PR as a simple fix for #9354 to improve current behavior.