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

Add a state request to get the block hash, height, and transaction index from the transaction ID #7943

Closed
Tracked by #7728
teor2345 opened this issue Nov 14, 2023 · 2 comments
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes

Comments

@teor2345
Copy link
Contributor

teor2345 commented Nov 14, 2023

Motivation

I don't think we need to store the block height or hash in the scanner storage. Using the transaction hash, we can get the block height and hash from the state, so there's no need to store it in the scanner as well.

Suggested Design

Here's how we could do that state request:

We can use the transaction hash to look up tx_loc_by_hash, which gives us a TransactionLocation containing the block height (and transaction index). And we can get the block hash from the height. We have read::find methods for some of this already.

There are similar methods in the non-finalized state. This method should be for any chain, but prefer the best chain.

https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/state-db-upgrades.md#current-state-database-format

https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/read/find.rs#L129

Originally posted by @teor2345 in #7942 (comment)

@mpguerra mpguerra added this to Zebra Nov 14, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra Nov 14, 2023
@teor2345 teor2345 added P-Low ❄️ A-state Area: State / database changes A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Nov 14, 2023
@oxarbitrage
Copy link
Contributor

I think this is optional initially but feel free to remove the label.

@mpguerra
Copy link
Contributor

We won't be doing any more work on the scanner

@mpguerra mpguerra closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
@github-project-automation github-project-automation bot moved this from New to Done in Zebra Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes
Projects
Status: Done
Development

No branches or pull requests

3 participants