Chainparams: Use a regular factory for creating chainparams

This commit is contained in:
Jorge Timón
2015-05-22 03:50:01 +02:00
parent 35da2aeed7
commit f87f3626e3
6 changed files with 58 additions and 39 deletions

View File

@@ -5,6 +5,7 @@
#ifndef BITCOIN_CHAINPARAMSBASE_H
#define BITCOIN_CHAINPARAMSBASE_H
#include <memory>
#include <string>
#include <vector>
@@ -30,6 +31,13 @@ protected:
std::string strDataDir;
};
/**
* Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
* @returns a CBaseChainParams* of the chosen chain.
* @throws a std::runtime_error if the chain is not supported.
*/
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain);
/**
* Append the help messages for the chainparams options to the
* parameter string.
@@ -42,8 +50,6 @@ void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp=true);
*/
const CBaseChainParams& BaseParams();
CBaseChainParams& BaseParams(const std::string& chain);
/** Sets the params returned by Params() to those for the given network. */
void SelectBaseParams(const std::string& chain);