This repository was archived by the owner on Mar 1, 2019. It is now read-only.
Fix Metadata Inconsistency After Wallet or Account Deletion #146
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.
Linked Issue
#141
Overview
It discards incoherent transactions fetched from the DB, if any, and shout a warning in the log.This is in order to make the system more resilient to concurrent calls while a wallet or account is being deleted (since metadata and accounts / wallets are stored in separated databases, we can't easily run both delete in a single transaction).
It deletes corresponding metadata when an account or a wallet is removed. This may cause extra damage? What if there are pending transactions when we delete the account or wallet.
It now ignores insertion violations thay may occur if a user restore a deleted wallet or account. Cleaning up the metadata table itself isn't sufficient; we also need (in theory) to cleanup the corresponding inputs and outputs though in practice, this isn't that simple. Inputs may be used by different tx. Ideally, we would rely on db foreign keys for that but
beam
(the library we use to talk to SQLite) doesn't support them... Therefore, dust remains in the DB after deletion which is acceptable for now.It adds a few regression integration scenarios to illustrate the various fixes.
Comments
This is actually a port of cardano-sl#3943 already reviewed and discussed with Kostas.
Checklist