Skip to content

CW 1109 fix: incorrect restore height sometimes being set on monero #2390

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

Merged
merged 2 commits into from
Jul 17, 2025

Conversation

MrCyjaneK
Copy link
Collaborator

Issue Number (if Applicable): Fixes #

Description

fix: incorrect restore height sometimes being set on monero

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods
  • Manual tests in accessibility mode (TalkBack on Android) passed

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is not the intended change, right? as it was modified recently by @CumpsD

Copy link
Contributor

Choose a reason for hiding this comment

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

the as doubles should probably be ok.

the List<Map<String, dynamic>> I tried as well, but it crashed out when I tested so I had to go List<dynamic>

But if you test List<Map<String, dynamic>> and it works, that would be more correct, but please do test it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not needed but couldn't get the code to compile with that, I can revert

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me ping @konstantinullrich to see what he has to say :)

Comment on lines 834 to 836
final distance =
DateTime.now().millisecondsSinceEpoch - date.millisecondsSinceEpoch;
DateTime.now().difference(date).inSeconds;
final daysTmp = (distance / 86400).round();
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor:

final daysTmp = DateTime.now().difference(date).inDays;

Comment on lines +822 to +825
unawaited(() async {
await Future.delayed(Duration(seconds: 10));
_setHeightFromDate(tryNum: tryNum + 1);
}());
Copy link
Contributor

Choose a reason for hiding this comment

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

should we return after this unawaited?
else it will excute

monero_wallet.setRecoveringFromSeed(isRecovery: true);
setupBackgroundSync(password, currentWallet!);

for the other trials as well,
or are they safe functions to get called frequently?

even better i would prefer separating the function that can fail and retried, from the other function calls

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can continue, this function is safe to call multiple times, we can separate that if you prefer, but setupBackgroundSync also needs to be called - so only setRecoveringFromSeed would get removed

@OmarHatem28 OmarHatem28 merged commit 0da7047 into main Jul 17, 2025
5 checks passed
@OmarHatem28 OmarHatem28 deleted the CW-1109-monero-wallet-forgets-its-restore-height branch July 17, 2025 03:41
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.

3 participants