Skip to content

Conversation

benma
Copy link
Contributor

@benma benma commented Aug 26, 2025

Hidden accounts are added and scanned so they can be shown if they are not empty. This should have happened for the first 5 accounts always (since we allowed 5 empty accounts to be added), but further accounts only if the previous account was non-empty.

maybeAddHiddenUnusedAccounts() had an off-by-one error where we added and scanned the sixth account even if all accounts before were empty. It should have stopped at the fifth.

As a result, adding a new account worked even if the user already had 5 accounts, even if the last account was empty, as adding an account implicitly assumes that existing hidden accounts only could exist if they could be added.

We can fix the off-by-one, but since there might be users out there (even if unlikely) that added such a sixth account, we now should always auto-discover the first six instead of the first five accounts, even if all are empty, so we bump this number. This should not put more load on our servers, as the app already always scanned six accounts due to this bug.

Before asking for reviews, here is a check list of the most common things you might need to consider:

  • updating the Changelog
  • writing unit tests
  • checking if your changes affect other coins or tokens in unintended ways
  • testing on multiple environments (Qt, Android, ...)
  • having an AI review your changes

@benma benma requested a review from bznein August 26, 2025 20:03
Copy link
Collaborator

@bznein bznein left a comment

Choose a reason for hiding this comment

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

utACK

Hidden accounts are added and scanned so they can be shown if they are
not empty. This should have happened for the first 5 accounts
always (since we allowed 5 empty accounts to be added), but further
accounts only if the previous account was non-empty.

`maybeAddHiddenUnusedAccounts()` had an off-by-one error where we added and scanned
the sixth account even if all accounts before were empty. It should
have stopped at the fifth.

As a result, adding a new account worked even if the user already had
5 accounts, even if the last account was empty, as adding an account
implicitly assumes that existing hidden accounts only could exist if
they could be added.

We can fix the off-by-one, but since there might be users out
there (even if unlikely) that added such a sixth account, we now
should always auto-discover the first six instead of the first five
accounts, even if all are empty, so we bump this number. This should
not put more load on our servers, as the app already always scanned
six accounts due to this bug.
@benma benma merged commit ad29afd into BitBoxSwiss:master Aug 28, 2025
8 of 9 checks passed
@benma benma deleted the too-many branch August 28, 2025 13:58
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