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

fixes rescanning wallet to always set account heads #3654

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

hughy
Copy link
Contributor

@hughy hughy commented Mar 15, 2023

Summary

the logic of 'connectBlock' filters any account that does not have its 'head' equal to the previous block. this means that if we don't reset account heads during rescan nothing will happen.

this is also true of rescanning using the '--from' flag. this flag lets users start the rescan at a particular sequence. however, if we don't set account heads to that sequence then scanning won't do anything.

  • removes the 'reset' option and always resets accounts
  • throws an error if the 'from' sequence is not in the chain or the header at that sequence is not on the main chain
  • sets account heads equal to the block header before the from sequence if it is not the genesis block

Testing Plan

  • updated unit tests
  • manual testing

before:
image
Finishes scanning almost immediately and then hits an error

after:
image

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[X] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes

the logic of 'connectBlock' filters any account that does not have its 'head'
equal to the previous block. this means that if we don't reset account heads
during rescan nothing will happen.

this is also true of rescanning using the '--from' flag. this flag lets users
start the rescan at a particular sequence. however, if we don't set account
heads to that sequence then scanning won't do anything.

- removes the 'reset' option and always resets accounts
- throws an error if the 'from' sequence is not in the chain or the header at
  that sequence is not on the main chain
- sets account heads equal to the block header before the from sequence if it is
  not the genesis block
@hughy hughy requested a review from a team as a code owner March 15, 2023 16:55
@hughy hughy changed the title fixes rescanning wallet without --reset fixes rescanning wallet to always set account heads Mar 15, 2023
Copy link
Contributor

@EvanJRichard EvanJRichard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing redundant rpc options? Increasing unit testing? I dig it. :shipit:

@hughy hughy merged commit 32aea33 into staging Mar 20, 2023
@hughy hughy deleted the fix/rescan-no-reset branch March 20, 2023 20:00
hughy added a commit to iron-fish/website that referenced this pull request Mar 21, 2023
following iron-fish/ironfish#3654 'reset' is no longer
a request parameter for rescanAccount and all rescans will reset the wallet
database.
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 this pull request may close these issues.

2 participants