Skip to content
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

zcash_client_sqlite: Add migration to link utxo table to transactions #503

Open
str4d opened this issue Feb 2, 2022 · 1 comment
Open

Comments

@str4d
Copy link
Contributor

str4d commented Feb 2, 2022

Currently the utxo table has columns for storing the transaction ID, and the mined block height. These are almost always duplicative of entries in the transaction table, and having them stored separately inhibits other possible relational queries.

We should implement a migration to:

  • Add a tx foreign key column.
  • Migrate existing utxo entries to reference matching transactions entries.
  • For those utxo entries that do not have matches, fetch the corresponding transactions from lightwalletd to populate the remaining transactions entries that the wallet assumes are populated during scanning.

The division of this work between the database migration and the network fetching might affect internals, but at a high level the migration API provided to zcash_client_sqlite users should hopefully be straightforward in the instructions it gives them.

@nuttycom
Copy link
Contributor

We discovered that is more challenging than we thought, because if we set the block height of the transactions entry, this requires an entry in the blocks table and we'd need at least the block hash to create such an entry; in addition, we now have the property "every entry in the blocks table corresponds to a block that we have scanned" so supporting this database refactoring will likely require other kinds of changes.

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

No branches or pull requests

2 participants