-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Continue proof of work encapsulation #5171
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
Conversation
src/pow.h
Outdated
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.
Nit: these
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.
Can you explain the nit a little bit more?
|
utACK, apart from the above nits. |
|
Added commit to correct nits (plus fix a missing include). |
|
ping |
|
Rebased for clarity after #5170 being merged. |
|
Needed rebase. |
|
This definitely makes the code more readable, it rebases on 0.10 without problems and its the sort of change that helps to isolate and track pow related operations. It adds the following functions to pow.h: bool CheckChallenge(const CBlockHeader& block, const CBlockIndex& indexLast);
void ResetChallenge(CBlockHeader& block, const CBlockIndex& indexLast);
/** Avoid using these functions when possible */
double GetChallengeDifficulty(const CBlockIndex* blockindex);
std::string GetChallengeStr(const CBlockIndex& block);
std::string GetChallengeStrHex(const CBlockIndex& block);
uint32_t GetNonce(const CBlockHeader& block);
void SetNonce(CBlockHeader& block, uint32_t nNonce);It may be desirable to add to the comment: brief reason why to avoid those functions and a mention where they are currently called (rpcblockchain.cpp and rpcmining.cpp). |
|
NACK "more readable" is not a good justification to be messing around with this code. If anything, I'd argue it makes the code less readable as what it's actually doing has been obscured by more layers of abstraction. |
|
Well, it introduces the |
|
Closing for now, at least until #5599 has been merged (if it gets merged) and I can propose something more complete. |
It is built on top of #5170, replaces #4506 and continues #4377.