-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Make REGTEST quack like a duck #3812
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
|
I usually recommend against core changes just to make it easier for the GUI. In this case, the logic "is a test net?" is only used in the outer function to determine whether to tint the client green or not. |
|
Thanks for the feedback. Thinking more about it, doesn't really make much sense. TestNet() may seem more convenient than Params().testNet() or Params().isTestNet() but makes the code less readable. Actually my preference would be params.isTestNet(), using a simple instance instead of a const global-ish function, but it's probably better to refactor a little bit at a time. |
|
The intention was to get rid of TestNet/RegTest eventually. The idea behind CChainParams is to encompass the properties "quacks like a duck" of the chain. TestNet() / RegTest() are "is this specific chain the ..." identify functions. Moving them to the object is a bit strange in my eyes as by definition there is only one TestNet and one RegTest. The idea would be to split the TestNet() / RegTest() up into specific properties of the appropriate networks. However the few calls to TestNet/RegTest left are very specialized properties like "switch difficulty to min after nTargetSpacing*2 time between blocks" for which it's likely not worth making individual queries (come up with a name for that!). |
|
Ok, that makes sense. So, yes, the proposed change is not a big move in that direction. |
|
Any idea why this could have failed? I'm going back and forth on whether "Params().NetworkID() ==" or TestNet() is better but we should certainly only have one or the other and be consistent. My initial thought that was "Params().NetworkID() ==" was different from "Params().NetworkID() !=" and harder to grep, but that could be easily solved with Params().isNetwork(network) or something like that. Anyway, now it's easier for me to get rid of Params().isRegtest() which is really my goal here (moving towards the "quack like a duck"). So this is definitely not prepared for merging yet, but it's good to have some feedback in the meantime. |
|
Now REGTEST "quacks like a duck". It's useful for me to destroy and restore things when refactoring, but maybe is not so good for merging? |
|
Automatic sanity-testing: FAILED BUILD/TEST, see http://jenkins.bluematt.me/pull-tester/992f5be1e106affc55109749ac7940cd11b5cef7 for binaries and test log. This could happen for one of several reasons:
If you believe this to be in error, please ping BlueMatt on freenode or TheBlueMatt here. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ |
|
Ok, it seems I'm not building on top of the latest changes, I'll start again. Closing. |
Less calls to functions that could be methods of CChainParams.