Skip to content

Conversation

pstratem
Copy link
Contributor

@pstratem pstratem commented May 2, 2016

Moves both functions closer to being pure.

I want this to improve my fuzzing results.

Moves both functions closer to being pure.
@gmaxwell
Copy link
Contributor

gmaxwell commented May 2, 2016

Concept ACK.

@dcousens dcousens mentioned this pull request May 2, 2016
@dcousens
Copy link
Contributor

dcousens commented May 2, 2016

utACK b3a9f85

@btcdrak
Copy link
Contributor

btcdrak commented May 2, 2016

utACK

@jonasschnelli
Copy link
Contributor

utACK b3a9f85

@maflcko
Copy link
Member

maflcko commented May 2, 2016

utACK b3a9f85

@laanwj
Copy link
Member

laanwj commented May 5, 2016

utACK b3a9f85

(maybe this could be taken even further, I'm not sure what you're rationale is to stop at e.g. ConnectBlock but not TestBlockValidity, but it's a good start)

@pstratem
Copy link
Contributor Author

pstratem commented May 5, 2016

@laanwj I was trying to fuzz these two functions and was unable to do so easily.

In the near future I'm certain I'll have the same issue elsewhere.

@@ -3212,20 +3212,20 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne
return true;
}

bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW)
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, int64_t nAdjustedTime, bool fCheckPOW)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not too late for bikeshedding...all the times I've tried to do this, I've named the variable nTime instead of nAdjustedTime. Not important, but would make https://github.com/jtimon/bitcoin/commits/jt easier to rebase to 0.13...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except... it's actually the adjusted time

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever...no big deal

@jtimon
Copy link
Contributor

jtimon commented May 20, 2016

Can you also pass Consensus::Params like in #7947 ? The diff shouldn't grow much and it would save us from changing exactly the same lines twice. Should also be better for fuzzing.

@pstratem
Copy link
Contributor Author

@jtimon I made a decision not to pass Params() to keep the commit clean and obviously correct.

@jtimon
Copy link
Contributor

jtimon commented May 20, 2016

IMO the commit will remain clean and obviously correct. It's currently +11 -11, and I predict it to become +15 -13 or less.
Do you want me to provide a fixup! commit for you to decide whether to squash it or not?

@pstratem
Copy link
Contributor Author

@jtimon Nope I think this is as much change as I want to be in this PR.

@jtimon
Copy link
Contributor

jtimon commented May 20, 2016

If we do the thing in 2 steps, it will be about 2 commits +11 -11.
I guess I'll open competing PR then...

@jtimon
Copy link
Contributor

jtimon commented May 20, 2016

Opened #8077 which also does ContextualCheckBlockHeader (+16 -17). I believe that's still clean and obviously correct (even if the scope is bigger).

@maflcko
Copy link
Member

maflcko commented Jun 1, 2016

#8077 has been merged.

@maflcko maflcko closed this Jun 1, 2016
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants