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

Closed
str4d opened this issue Feb 2, 2022 · 3 comments
Closed

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.

@str4d
Copy link
Contributor Author

str4d commented Jun 30, 2024

This was partially closed by #1402. We added the migrations, but did not add logic to fetch extra data for the previously-missing transactions table rows, as it turned out the tables seem to work fine with just what we knew from the utxo table. We still need to fetch that data though, so leaving this issue open until we either do that, or move the remaining work into a new issue (which we might already have done without noticing, but it's a weekend so I'm not checking).

@nuttycom
Copy link
Contributor

This was completed by #1402, #1493, #1476

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