fix(wallet): preserve parent when recording substate addresses #955
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.
Description
fix(wallet): preserve parent when recording substate addresses
Motivation and Context
If an account deposits a previously known resource into its account, it will mistakenly change the parent component to the account.
This is a workaround/hack to fix this, by never changing the initial parent once it has been set. The ideal fix would involve the validator node/indexer returning a more formal component-resource relationship to the wallet.
Due to the limited/inferred relationship data, a wallet will still list a resource parent as the account component in cases where it has not seen the resource before.
How Has This Been Tested?
Manually submitted a transaction that creates a resource via a component, then transactions that deposit some of that resource into the wallet. The parent component does not change after the initial transaction.
What process can a PR reviewer use to test or verify this change?
Upcoming NFT testing PR (https://github.com/Cifko/tari-dan/blob/dan-testing/applications/dan_testing/src/main.rs)
Breaking Changes