I had some misunderstandings about what @luke-jr and I agreed and disagreed on #5071.
That’s why I created #5180. The only disagreement is how you allow users to select Params().RequireStandard()
independently of the chainparams selected (but we agree that should be possible, @petertodd does too #5521 (comment)). That little disagreement is out of scope for this PR. The two potential solutions should be easier to review, maintain and discuss after this PR has been acked.
I thought he also disagreed on:
- Only the interface can be accessed from outside policy.cpp, the implementation is hidden.
- policy.o shouldn’t depend on main.h or contain any concurrency-related code.
He doesn’t disagree, he was just doing some things faster and left others for later in his version of policy encapsulation (https://github.com/luke-jr/bitcoin/tree/nodepolicy2). There’s a version rebased on top of this PR that satisfies 1 but not 2 in https://github.com/jtimon/bitcoin/tree/luke_policy2 [I’m afraid I’ve also introduced an error in the last 3 commits]. He thought I also disagreed on:
- static variables contained in policy.o should become parameters of the reference policy implementation (CStandardPolicy).
I don’t: I was just leaving that for later.
This PR is mostly composed of code movements that I expect will be uncontroversial. 3 commits just move a single function and its associated globals if any. 2 of them are not purely moveonly because they change the function headers or move some functionality from one function to another, but are mostly code movements. Finally, the last commit creates a CPolicy interface (abstract class) and a CStandardPolicy implementation; and it’s open for method name bikesheding. @luke-jr if you like this PR I’m closing #5595 and #5114.