-
Notifications
You must be signed in to change notification settings - Fork 27
fix: clear tokens from other networks #660
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andreabadesso
approved these changes
Mar 10, 2025
src/sagas/wallet.js
Outdated
@@ -162,7 +162,10 @@ export function* startWallet(action) { | |||
// but the wallet may be closed unexpectedly | |||
const storage = STORE.getStorage(); | |||
yield call([storage.store, storage.store.cleanMetadata]); // clean metadata on memory | |||
yield call([storage, storage.cleanStorage], true); // clean transaction history | |||
// clean transaction history, addresses, token and nano-contract indexes | |||
// XXX: It would be better to keep registered tokens and nano contracts |
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.
Do we have an issue created describing this?
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.
Yes, we have:
76dd706
to
9cfb479
Compare
9cfb479
to
dd01b71
Compare
pedroferreira1
approved these changes
Mar 13, 2025
andreabadesso
approved these changes
Mar 19, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
When changing networks, the registered tokens were not being cleaned properly. This resulted in situations like testnet tokens being exhibited while the user is on mainnet. This was raised by #385 .
Acceptance Criteria
Alternative Solutions
A more user-friendly approach to this issue would be comparing the genesis block of the previous network ( if any ) and the current network, and only cleaning those tokens if these hashes changed.
This would ensure that changing the fullnode while staying inside the same network ( for example, changing from
https://node1.mainnet.hathor.network/v1a/
tohttps://node2.mainnet.hathor.network/v1a/
) would not remove all registered tokens unnecessarily.This solution was not implemented here so that the bug is fixed immediately, while this greater refactor is left to #667 .
Security Checklist