Add '--enable-mainnet' configure and bitcoind option #11901

issue maaku opened this issue on December 14, 2017
  1. maaku commented at 8:01 PM on December 14, 2017: contributor

    Feature request: add a configuration option '--enable-mainnet' which defaults to false but is set to true by the gitian builds. When true, behavior is unaffected. When false (the default for someone cloning the repo and building with no configuration options), the resulting binary will require a new 'enablemainnet' option to be set in order to launch the daemon or Qt GUI with main net chain params.

    This prevents developers or downstream system integrators from accidentally corrupting main net wallets or block chain data when developing new features. It has happened to me multiple times in the past that I've corrupted wallets while implementing and debugging new wallet features. Of course these were either testnet wallets, or I was careful to backup the wallet first. But we should strive to create a development environment without single-point failure potential to prevent fat-finger mistakes if nothing else.

  2. MarcoFalke added the label Tests on Dec 14, 2017
  3. MarcoFalke added the label Build system on Dec 14, 2017
  4. luke-jr commented at 11:19 PM on December 14, 2017: member

    Concept ACK. This also avoids (to an extent) the common mistake of end users running master. (We can maybe enable by default for stable branches)

  5. MarcoFalke added the label good first issue on Jan 21, 2018
  6. jeffrade commented at 3:50 AM on January 26, 2018: contributor

    I started working on this issue, but want to make sure I understand what is requested before submitting a PR:

    • Add --enable-mainnet option flag when running ./configure
    • If above flag is present, define ENABLE_MAINNET for pre-processor in src/chainparamsbase.cpp.
    • ChainNameFromCommandLine() in src/chainparamsbase.cpp will now set new boolean fMainNet where it will look for -enablemainnet arg to run mainnet chain (but default to true if ENABLE_MAINNET).
    • If ENABLE_MAINNET config is not set and -enablemainnet flag is not passed to binary, bitcoind will run on testnet chain.
    • (TODO) Update any help docs/output/markup since mainnet was defaulted and had to explicitly set -regtest or -testnet.

    Here is a quick implementation in my branch. Am I on the right track (C++ noob here)?

  7. luke-jr commented at 4:25 AM on January 26, 2018: member

    I think you understood it backward. If the configure option is used, mainnet should be the default. Only if configured with --disable-mainnet (default) should a command-line option be required at runtime.

  8. jeffrade commented at 2:09 PM on January 26, 2018: contributor

    Thanks @luke-jr, will get a PR open for this soon.

    EDIT: PR open

  9. MarcoFalke removed the label good first issue on Apr 11, 2018
  10. MarcoFalke commented at 8:11 PM on April 11, 2018: member

    There is a pull request for this feature. Please review/comment there

  11. MarcoFalke closed this on Apr 11, 2018

  12. MarcoFalke commented at 12:41 PM on April 26, 2018: member

    Note: The pull request was closed with the rationale "There is no agreement to do this"

  13. DrahtBot locked this on Sep 8, 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-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me