Add a state request to get the block hash, height, and transaction index from the transaction ID #7943
Labels
A-blockchain-scanner
Area: Blockchain scanner of shielded transactions
A-state
Area: State / database changes
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 aTransactionLocation
containing the block height (and transaction index). And we can get the block hash from the height. We haveread::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)
The text was updated successfully, but these errors were encountered: