-
Notifications
You must be signed in to change notification settings - Fork 106
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
fix(rpc): Add getblock
RPC fields to support the latest version of zcash/lightwalletd
#6134
Conversation
zcash/lightwalletd
getblock
RPC fields to support the latest version of zcash/lightwalletd
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6134 +/- ##
==========================================
- Coverage 78.14% 78.03% -0.11%
==========================================
Files 304 304
Lines 39087 39125 +38
==========================================
- Hits 30546 30533 -13
- Misses 8541 8592 +51 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you for fixing this.
Is the 'A-consensus' label correct? (is it for the confirmations
field?)
This blocks our next Zebra release because we want to be able to support this bug fix in For the Zebra team: this is an example of a race condition where using a hash rather than a height matters. |
I could go either way, it fixes a consensus bug in Feel free to take it off if you'd like? |
Motivation
The latest version of
zcash/lightwalletd
expects thegetblock
response to always contain the blockhash
field:https://github.com/zcash/lightwalletd/blob/5d174f7feb702dc19aec5b09d8be8b3d5b17ce45/common/common.go#L282
This PR gets the
hash
if needed, using a state index lookup.Close #6085.
Specifications
https://zcash.github.io/rpc/getblock.html
The height to hash lookup isn't specified, but we can assume they want the hash at that height on the best chain.
Complex Code or Requirements
For consistency even if the chain changes, we look up the block hash first, then use the hash to look up the transaction IDs and block confirmations.
Solution
getblockchain-rpcs
feature, but we need it for the hash lookup in production RPCshash
in the getblock RPC responsehash
, it's easy to always getconfirmations
as wellTesting:
hash
andconfirmations
fieldslightwalletd
integration test to work withzcash/lightwalletd
I manually checked that
zcash/lightwalletd
works with Zebra's integration tests. (In CI we useadityapk00/lightwalletd
.)Review
We might want to get this in the next release, but it's not a blocker.
Reviewer Checklist
Follow Up Work
We might want to test both
lightwalletd
forks in CI, to avoid issues like this in future.@gustavovalverde can you put this in the CI review doc?