Skip to content

Conversation

@jtimon
Copy link
Contributor

@jtimon jtimon commented Aug 31, 2014

Continues #4801 (and #3823 #3824 #4333).

Copy link
Member

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.

@jtimon
Copy link
Contributor Author

jtimon commented Sep 1, 2014

Removed the gui specific flag in favor of using the bip70 string id.
If there's nothing controversial with the checkpoints in #4801 I can just close it as it is included here (also close this one since it is included in #4804 ).
I probably shouldn't have open so many of them in the first place...

@TheBlueMatt
Copy link
Contributor

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.

@laanwj
Copy link
Member

laanwj commented Sep 3, 2014

Testnet is not going to be deprecated, but the getinfo call is (and the testnet field on it). Ever since we support three chains, having a boolean is not enough anymore. getblockchaininfo returns much more information about the current chain.

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.

@jtimon
Copy link
Contributor Author

jtimon commented Sep 3, 2014

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.
@laanwj explained the deprecation thing, but basically, RPCs can just use bip70's networkidstring()
For the string, I was going to create another flag but @laanwj wants to keep chainparams clean of GUI-related things. Of course comparing to an enumerator is better than comparing to a string, again, the goal is that people don't see the comparation to the enumeration and think they can call CChainParams::NetworkID(), hopefully the comparison with a string will make people use that approach less, but we need the string for BIP70 anyway.

With respect to the checkpoints,t his way we avoid the calls to Params().NetworkID() in checkpoints.cpp.
If at some point we're going to read the chainparams from data files, we probably want to put the checkpoint data there as well.
At that point writing a new mode should be as simple as writing a json or xml file.

So in summary, the goal here is not readability, is to maintain readability by killing NetworkID(), which shouldn't be used.

@laanwj
Copy link
Member

laanwj commented Sep 3, 2014

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.

Copy link
Member

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)

@jtimon
Copy link
Contributor Author

jtimon commented Sep 22, 2014

Since I had to squash the fix addressing @laanwj suggestions and the first two commits, I just rebased on top of the current master.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4802_9d9770dbf0612dba4073437e0a69259f299908f7/ for binaries and test log.
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/
Contact BlueMatt on freenode if something looks broken.

Copy link

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?

Copy link
Member

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.

Copy link

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?

Copy link
Member

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.

@jtimon jtimon force-pushed the chainparams2 branch 2 times, most recently from f595af7 to c1c7440 Compare October 6, 2014 07:55
@jtimon
Copy link
Contributor Author

jtimon commented Oct 6, 2014

rebased

Copy link
Member

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?

Copy link
Contributor

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).

Copy link
Contributor Author

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.

@sipa
Copy link
Member

sipa commented Oct 9, 2014

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.

@gmaxwell
Copy link
Contributor

gmaxwell commented Oct 9, 2014

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

@TheBlueMatt
Copy link
Contributor

If you provide a GUITestNetFlag and use that in getinfo too, I'll be happy to ACK here.

@laanwj
Copy link
Member

laanwj commented Oct 9, 2014

@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 getinfo testnet has a different interpretation: regtest is not testnet according to getinfo, where it is for the GUI (right now!).

@jtimon
Copy link
Contributor Author

jtimon commented Oct 9, 2014

"If you provide a GUITestNetFlag"
I did that previously but @laanwj doesn't want anything gui-specific in chainparams, which makes a lot of sense. Making an ismainet flag defeats the purpose of removing networkID().
Thus we used the bip70 string. The performance penalty is meaningless, specially in the context of a GUI.

"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.

@laanwj
Copy link
Member

laanwj commented Oct 9, 2014

If the string match in the GUI is such a big problem, I'll go refactor that right now...
Edit: uh... didn't mean to close this, sorry.

@laanwj laanwj closed this Oct 9, 2014
@laanwj laanwj reopened this Oct 9, 2014
@laanwj
Copy link
Member

laanwj commented Oct 9, 2014

See #5066.

laanwj added a commit to laanwj/bitcoin that referenced this pull request Oct 9, 2014
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.
@jtimon
Copy link
Contributor Author

jtimon commented Oct 9, 2014

Rebased on top of #5066, no more string comparison.

@laanwj
Copy link
Member

laanwj commented Oct 10, 2014

@jtimon can you please cherry-pick laanwj/bitcoin@afd2a6b into my commit here? (small fix after nit by @theuni)
Tested ACK apart from that.

laanwj and others added 4 commits October 10, 2014 11:00
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.
@jtimon
Copy link
Contributor Author

jtimon commented Oct 10, 2014

@laanwj cherry picked and squashed

@laanwj laanwj merged commit 6fd546d into bitcoin:master Oct 10, 2014
laanwj added a commit that referenced this pull request Oct 10, 2014
6fd546d Remove CChainParams::NetworkID() (jtimon)
cc97210 Add fTestnetToBeDeprecatedFieldRPC to CChainParams (jtimon)
e11712d Move checkpoint data selection to chainparams (jtimon)
6de50c3 qt: add network-specific style object (Wladimir J. van der Laan)
reddink pushed a commit to reddcoin-project/reddcoin-3.10 that referenced this pull request May 27, 2020
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants