Skip to content
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

multi: remove chainState deps in server & cpuminer. #1419

Merged
merged 2 commits into from
Sep 12, 2018

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented Aug 22, 2018

This PR requires #1417 and #1418.

Port of upstream commit 2274d36 (subset). In preparation of the
removal of chainState.

@dnldd dnldd force-pushed the rm_chainstate_server_and_cpuminer branch 3 times, most recently from 88cebec to b837015 Compare August 22, 2018 22:28
@davecgh davecgh added this to the 1.4.0 milestone Aug 22, 2018
@dnldd dnldd force-pushed the rm_chainstate_server_and_cpuminer branch from b837015 to 5de2819 Compare August 22, 2018 23:46
//
// TODO: Ideally this would not return an error, but changing the function
// would require a major version bump to the mempool module.
// The next time a major version is released, the error should be removed.
Copy link
Member

Choose a reason for hiding this comment

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

While this is true for the particular implementation currently used in this PR, the point of decoupling the structures by using a function reference is that you don't need to know whether the impl returns an error or not. So I'd say that you should just maintain this function signature and the subsequent error checking.

mining.go Outdated
best := blockManager.chain.BestSnapshot()
prevHash := best.Hash
nextBlockHeight := best.Height + 1
if prevHash != best.Hash ||
Copy link
Member

Choose a reason for hiding this comment

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

Does this check make sense, given that you just set prevHash := best.Hash? What could cause them to not be equal?
It seems that given you're now using BestSnapshot exclusively (vs using chainState) this whole test can be dropped as it doesn't make sense anymore (bestSnapshot should not change during its lifetime).

@dnldd dnldd force-pushed the rm_chainstate_server_and_cpuminer branch 4 times, most recently from 0a3cef6 to b1c75f2 Compare September 11, 2018 22:36
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

The commit title does not follow the guidelines.

@dnldd dnldd changed the title multi: remove chainState dependencies in server and cpuminer. multi: remove chainState deps in server & cpuminer. Sep 12, 2018
@dnldd dnldd force-pushed the rm_chainstate_server_and_cpuminer branch from b1c75f2 to 346e582 Compare September 12, 2018 10:09
Port of upstream commit 2274d36 (subset). In preparation of the
removal of chainState.
Port of upstream commit 2274d36 (subset). In preparation of the
removal of chainState.
@dnldd dnldd force-pushed the rm_chainstate_server_and_cpuminer branch from 346e582 to c0b0b6c Compare September 12, 2018 15:28
@davecgh davecgh merged commit c0b0b6c into decred:master Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants