refactor: Use name constants in chainparams initialization #17306

pull jtimon wants to merge 1 commits into bitcoin:master from jtimon:b20-chain-constants changing 1 files +3 −3
  1. jtimon commented at 7:32 PM on October 29, 2019: contributor

    I thought this wouldn't work for some reason, but it seems it does. Just a little bit more consistency. I'm still not able to use them in qt/networkstyle.cpp though, not sure why.

  2. Chainparams: Use name constants in chainparams initialization 37b8475dcf
  3. jtimon cross-referenced this on Oct 29, 2019 from issue Tests: Chainparams: Make regtest almost fully customizable by jtimon
  4. fanquake added the label Refactoring on Oct 29, 2019
  5. MarcoFalke renamed this:
    Use name constants in chainparams initialization
    refactor: Use name constants in chainparams initialization
    on Oct 29, 2019
  6. MarcoFalke commented at 7:36 PM on October 29, 2019: member

    ACK 37b8475dcf61383dffffebae374eab07c14aee80

  7. in src/chainparams.cpp:257 in 37b8475dcf
     253 | @@ -254,7 +254,7 @@ class CTestNetParams : public CChainParams {
     254 |  class CRegTestParams : public CChainParams {
     255 |  public:
     256 |      explicit CRegTestParams(const ArgsManager& args) {
     257 | -        strNetworkID = "regtest";
     258 | +        strNetworkID =  CBaseChainParams::REGTEST;
    


    fjahr commented at 7:46 PM on October 29, 2019:

    There seems to be an unnecessary white space here.


    MarcoFalke commented at 8:07 PM on October 29, 2019:

    You may install clang-format and run the https://github.com/bitcoin/bitcoin/tree/master/contrib/devtools#clang-format-diffpy script to preempt whitespace nitpicking.

  8. hebasto approved
  9. hebasto commented at 7:48 PM on October 29, 2019: member

    ACK 37b8475dcf61383dffffebae374eab07c14aee80, I have reviewed the code and it looks OK, I agree it can be merged.

  10. fjahr approved
  11. fjahr commented at 7:48 PM on October 29, 2019: contributor

    ACK 37b8475

  12. DrahtBot commented at 8:05 PM on October 29, 2019: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17032 (Tests: Chainparams: Make regtest almost fully customizable by jtimon)
    • #16411 (Signet support by kallewoof)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  13. practicalswift commented at 11:34 PM on October 29, 2019: contributor

    Concept ACK

    FWIW:

    $ git grep -E '("main"|"test"|"regtest")' -- "*.cpp" "*.h" 
    src/chainparams.cpp:        strNetworkID = "main";
    src/chainparams.cpp:        strNetworkID = "test";
    src/chainparams.cpp:        strNetworkID = "regtest";
    src/chainparamsbase.cpp:const std::string CBaseChainParams::MAIN = "main";
    src/chainparamsbase.cpp:const std::string CBaseChainParams::TESTNET = "test";
    src/chainparamsbase.cpp:const std::string CBaseChainParams::REGTEST = "regtest";
    src/chainparamsbase.cpp:        return MakeUnique<CBaseChainParams>("regtest", 18443);
    src/qt/bitcoin.cpp:    util::ThreadSetInternalName("main");
    src/qt/networkstyle.cpp:    {"main", QAPP_APP_NAME_DEFAULT, 0, 0},
    src/qt/networkstyle.cpp:    {"test", QAPP_APP_NAME_TESTNET, 70, 30},
    src/qt/networkstyle.cpp:    {"regtest", QAPP_APP_NAME_REGTEST, 160, 30}
    src/qt/test/apptests.cpp:    QCOMPARE(value["chain"].get_str(), std::string("regtest"));
    src/qt/test/rpcnestedtests.cpp:    { "test", "rpcNestedTest", &rpcNestedTest_rpc, {} },
    src/qt/test/rpcnestedtests.cpp:    QVERIFY(result=="main");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "main");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "regtest");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    test_args.SelectConfigNetwork("test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
    src/test/util_tests.cpp:// - Testing "main" and "test" network values to make sure settings from network
    src/test/util_tests.cpp:        parser.AddArg("-regtest", "regtest", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
    src/test/util_tests.cpp:    BOOST_CHECK_EQUAL(FormatParagraph("test", 79, 0), "test");
    src/wallet/db.cpp:                            "main",             // Logical db name
    src/wallet/db.cpp:                            fMockDb ? strFilename.c_str() : "main",   // Logical db name
    src/wallet/db.cpp:                                            "main",             // Logical db name
    src/wallet/rpcwallet.cpp:    // Release the "main" shared pointer and prevent further notifications.
    src/wallet/test/wallet_crypto_tests.cpp:    TestCrypter::TestPassphrase(ParseHex("0000deadbeef0000"), "test", 25000, \
    
  14. MarcoFalke added the label Waiting for author on Oct 30, 2019
  15. laanwj commented at 11:22 AM on October 30, 2019: member

    ACK 37b8475dcf61383dffffebae374eab07c14aee80

  16. laanwj referenced this in commit f129170b85 on Oct 30, 2019
  17. laanwj merged this on Oct 30, 2019
  18. laanwj closed this on Oct 30, 2019

  19. jtimon commented at 12:37 PM on October 30, 2019: contributor

    This is one of the few times when I feel you guys merged this too fast. I would have happily removed the extra white space. I would also had happily added more cases like @practicalswift seems to be suggesting.

  20. laanwj commented at 12:43 PM on October 30, 2019: member

    I didn't see that the whitespace nit wasn't solved yet.

    I would also had happily added more cases like @practicalswift seems to be suggesting.

    I think it's a bad idea to extend the scope of a PR after two people have ACKed it. It's a trivially correct change and people agree with it, so it should be merged quickly.

  21. laanwj removed the label Waiting for author on Oct 30, 2019
  22. MarcoFalke commented at 12:46 PM on October 30, 2019: member

    It is not a disaster to have this merged, mistakes can always happen. Let's just fix up the nits in a follow-up.

  23. jtimon deleted the branch on Oct 30, 2019
  24. MarkLTZ cross-referenced this on Apr 4, 2020 from issue Bitcoin PR tracking by MarkLTZ
  25. bitcoin locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:54 UTC