getblockcount() and getblockhash() functions return conflicting results #2735
Labels
A-documentation
Area: Documentation
A-rpc-interface
Area: RPC interface
E-good-first-issue
Effort: Suitable for someone new to the codebase.
M-user-support
User support issue
Milestone
Issue overview
The getblockcount() and getblockhash() functions return inconsistent results when run from the zcash4mac client. I suspect that the bug is inside the daemon, because the daemon defines the two aforementioned functions.
Detailed bug description
When I ran the commands "./zcash-cli getblockhash 0" and "./zcash-cli getblockhash 219417" back to back, I received hash values for both, which implies that, at that moment, there were are at least 219418 blocks on the best block chain.
Next I ran the command "./zcash-cli getblockcount", which returned the value 219417.
Do you see the inconsistency? 219418 > 219417. The two methods suggest different values for the total number of blocks in the longest chain.
Both commands, getblockhash and getblockcount, in their "help" documentation, claim to refer to the longest or best block chain. I assume that "longest" and "best" mean the same thing in this context.
Also, as shown above, the documentation for getblockcount specifically states that it returns the "number of blocks", not the index of the highest block.
For reference, these are the commands that I ran, presented in the same order that I ran them:
Disclaimer
This "bug" might just be a minor case of imprecise language in the documentation.
Also, I don't know the details of the zcash protocol, so what I perceive as a bug might actually be the desired behavior.
The text was updated successfully, but these errors were encountered: