-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Remove CChainParams::NetworkID() #4802
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
src/chainparams.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't do this. Keep GUI-specific decisions in the GUI.
If you really insist on getting rid of the enumeration, you could match on NetworkIDString() instead to determine the network-specific theming.
|
I'm not sure this code is really more readable. Comparing to TESTNET to set a testnet flag is very readable (also, why are you saying testnet is deprecated?). Comparing to a string always seems worse than comparing to a constant to me, and I'm not convinced moving the checkpoint data to a separate file just to #include it in one cpp file is a good idea. |
|
Testnet is not going to be deprecated, but the And well, I can understand that the idea behind this is to have all the chain-specific data in a parameter data structure without 'identity'. But the GUI and the deprecated flag needs to know the network identity so there's an inherent conflict there. |
|
Yeah, comparing to the testnet id was very readable so it's the new flag. The difference is that when people see "NetworkID() == something" they think they can use that too, while FlagWithLongNameIncludingTheWordDeprecated() is not as likely to be used or that's my hope. With respect to the checkpoints,t his way we avoid the calls to Params().NetworkID() in checkpoints.cpp. So in summary, the goal here is not readability, is to maintain readability by killing NetworkID(), which shouldn't be used. |
|
With regard to the GUI comparing directly against the string, that doesn't have to stay that way in the future. Best would be to have a style sheet class name based on the network name or something like that. Anyhow, it's exceptional usage and only affects visuals. |
src/checkpoints.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkpoint_data shouldn't be included here (as that duplicates the data)
13e029d to
9d9770d
Compare
|
Since I had to squash the fix addressing @laanwj suggestions and the first two commits, I just rebased on top of the current master. |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4802_9d9770dbf0612dba4073437e0a69259f299908f7/ for binaries and test log. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand why that weird function name is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this flag (and the entire getinfo() ) is going to be deprecated. A boolean is no longer enough to define the chain that is used. For example it is defined as false for regtest, which is confusing to people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your answer is true for getinfo as we intend to remove or deprecate that, but in getmininginfo we should perhaps just update to what is now needed to define the chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Eventually we want to just have the chain identifier there (like in getblockchaininfo). That's unrelated to this pull though.
f595af7 to
c1c7440
Compare
|
rebased |
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this an improvement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the new option much less "neat". Though a general Params().GUITestNetFlag() might make sense here (and then use that flag with a // Deprecated comment in getinfo too - changes the meaning of "testnet" under regtest, but oh well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my initial version of the rpc flag changed the behaviour of regtest as suggested here, but it wasn't coupled with the gui flag.
|
I'm going to defer to @laanwj's opinion on the concept here; I personally don't consider string matching better than identifier matching... I do like the movement of the checkpoint data to chainparams, though. |
|
Code is fine, movement of checkpoint is good. The comparison with the string seemed unusual for our codebase, but perhaps it makes sense in the context of the GUI. Whatever wumpus wants. Conditional-ACK-on-Wumpus |
|
If you provide a GUITestNetFlag and use that in getinfo too, I'll be happy to ACK here. |
|
@sipa @gmaxwell The string matching will at most be temporary - as I said, it makes much more sense to have a stylesheet (or image directory name) with the name of the network (and that will be necessary to have different theming for regtest/testnet/mainnet anyway). That hasn't been implemented yet. It is a presentation-only attribute so I'm not concerned with having a string match here. Please do not add a a GUITestNetFlag to chain parameters, I've tried to get rid of GUI-specific flags in the core all the time. You cannot use the same flag for getinfo because the |
|
"If you provide a GUITestNetFlag" "and use that in getinfo too". No, the testnet flag is a deprecated flag that has to be removed when it is possible, thus it shouldn't be reused for anything else. Future RPC/rest interface should use the string instead. |
|
If the string match in the GUI is such a big problem, I'll go refactor that right now... |
|
See #5066. |
Mainly cleanups: Gets rid of isTestNet everywhere, by keeping track of network-specific theming in a central place. Also makes GUI no longer dependent on the network ID enumeration, which alleviates concerns about bitcoin#4802.
|
Rebased on top of #5066, no more string comparison. |
|
@jtimon can you please cherry-pick laanwj/bitcoin@afd2a6b into my commit here? (small fix after nit by @theuni) |
Mainly cleanups: Gets rid of isTestNet everywhere, by keeping track of network-specific theming in a central place. Also makes GUI no longer dependent on the network ID enumeration, which alleviates concerns about bitcoin#4802.
|
@laanwj cherry picked and squashed |
Mainly cleanups: Gets rid of isTestNet everywhere, by keeping track of network-specific theming in a central place. Also makes GUI no longer dependent on the network ID enumeration, which alleviates concerns about bitcoin#4802. (cherry picked from commit 6de50c3) # Conflicts: # src/qt/bitcoingui.cpp # src/qt/splashscreen.cpp
Continues #4801 (and #3823 #3824 #4333).