Page MenuHomePhabricator

Move CBlockIndexWorkComparator to its own header
ClosedPublic

Authored by jasonbcox on Jul 4 2018, 00:28.

Details

Summary

CBlockIndexWorkComparator belongs in its own header rather than validation.cpp. Also, this makes it more accessible for writing tests.

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Can you explain why the is moving into an header ? Probably belongs here is not a very good reason. If somethign is used only in one place, it belong there. Writing a test is a good reason to do it, but right now there are no tests for it.

Ok so we discussed this offline.

The benefit of putting this in a header is obviously to be able to write tests for it, which is great. The downside is that changing it will require to recompile half of the world due to chain.h being a very common header. A good way to proceed here would be to create a new header for CBlockIndexWorkComparator and include that header in validation.cpp instead of moving it into chain.h .

jasonbcox retitled this revision from Move CBlockIndexWorkComparator to chain.h to Move CBlockIndexWorkComparator to its own header.Jul 10 2018, 17:54
jasonbcox edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Jul 10 2018, 23:07
This revision was automatically updated to reflect the committed changes.