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
Separate concepts of block difficulty and network difficulty in RPC #1308
Separate concepts of block difficulty and network difficulty in RPC #1308
Conversation
@@ -140,6 +140,7 @@ extern int64_t nWalletUnlockTime; | |||
extern CAmount AmountFromValue(const json_spirit::Value& value); | |||
extern json_spirit::Value ValueFromAmount(const CAmount& amount); | |||
extern double GetDifficulty(const CBlockIndex* blockindex = NULL); | |||
extern double GetNetworkDifficulty(const CBlockIndex* blockindex = NULL); |
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.
Arrgh C++ is horrible (default arguments in declaration but not definition).
utACK, needs a test. |
"Block difficulty" is the difficulty listed in a block's header, which in the testnet can sometimes be min-difficulty (if time-since-last-block is too large). "Network difficulty" is the difficulty that the network was trying to satisfy at a particular block height. In mainnet this is always equal to the difficulty of the solved block for that height, but in testnet the network difficulty is derived from the last non-min-difficulty block difficulty. This commit fixes the RPC APIs that are intended to show network difficulty, so that on testnet they don't sometimes drop to 1.0, confusing users. Closes zcash#1181
a36b8e9
to
00939d0
Compare
Rebased on latest so that I could add the test to the newly-added |
ACK, good coverage. Thanks for writing that test. Good work! @zkbot r+ |
📌 Commit a36b8e9 has been approved by |
💡 This pull request was already approved, no need to approve it again. |
🙀 |
I updated the |
…es, r=ebfull Separate concepts of block difficulty and network difficulty in RPC "Block difficulty" is the difficulty listed in a block's header, which in the testnet can sometimes be min-difficulty (if time-since-last-block is too large). "Network difficulty" is the difficulty that the network was trying to satisfy at a particular block height. In mainnet this is always equal to the difficulty of the solved block for that height, but in testnet the network difficulty is derived from the last non-min-difficulty block difficulty. This commit fixes the RPC APIs that are intended to show network difficulty, so that on testnet they don't sometimes drop to 1.0, confusing users. Closes #1181
☀️ Test successful - zcash |
"Block difficulty" is the difficulty listed in a block's header, which in the
testnet can sometimes be min-difficulty (if time-since-last-block is too large).
"Network difficulty" is the difficulty that the network was trying to satisfy
at a particular block height. In mainnet this is always equal to the difficulty
of the solved block for that height, but in testnet the network difficulty is
derived from the last non-min-difficulty block difficulty.
This commit fixes the RPC APIs that are intended to show network difficulty, so
that on testnet they don't sometimes drop to 1.0, confusing users.
Closes #1181