You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chainparamsbase.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2014-2015 The Bitcoin Core developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef BITCOIN_CHAINPARAMSBASE_H
  5. #define BITCOIN_CHAINPARAMSBASE_H
  6. #include <string>
  7. #include <vector>
  8. /**
  9. * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
  10. * of a given instance of the Bitcoin system.
  11. */
  12. class CBaseChainParams
  13. {
  14. public:
  15. /** BIP70 chain name strings (main, test or regtest) */
  16. static const std::string MAIN;
  17. static const std::string TESTNET;
  18. static const std::string REGTEST;
  19. const std::string& DataDir() const { return strDataDir; }
  20. int RPCPort() const { return nRPCPort; }
  21. protected:
  22. CBaseChainParams() {}
  23. int nRPCPort;
  24. std::string strDataDir;
  25. };
  26. /**
  27. * Append the help messages for the chainparams options to the
  28. * parameter string.
  29. */
  30. void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp=true);
  31. /**
  32. * Return the currently selected parameters. This won't change after app
  33. * startup, except for unit tests.
  34. */
  35. const CBaseChainParams& BaseParams();
  36. CBaseChainParams& BaseParams(const std::string& chain);
  37. /** Sets the params returned by Params() to those for the given network. */
  38. void SelectBaseParams(const std::string& chain);
  39. /**
  40. * Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
  41. * @return CBaseChainParams::MAX_NETWORK_TYPES if an invalid combination is given. CBaseChainParams::MAIN by default.
  42. */
  43. std::string ChainNameFromCommandLine();
  44. /**
  45. * Return true if SelectBaseParamsFromCommandLine() has been called to select
  46. * a network.
  47. */
  48. bool AreBaseParamsConfigured();
  49. #endif // BITCOIN_CHAINPARAMSBASE_H