Skip to content

Commit

Permalink
Create segnet
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Dec 31, 2015
1 parent 0db375f commit a1c4143
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
55 changes: 55 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,59 @@ class CTestNetParams : public CChainParams {
};
static CTestNetParams testNetParams;

/**
* Segnet
*/
class CSegNetParams : public CChainParams {
public:
CSegNetParams() {
strNetworkID = "segnet";
consensus.nSubsidyHalvingInterval = 210000;
consensus.nMajorityEnforceBlockUpgrade = 7;
consensus.nMajorityRejectBlockOutdated = 9;
consensus.nMajorityWindow = 10;
consensus.BIP34Height = -1;
consensus.BIP34Hash = uint256();
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.SegWitHeight = 0;
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
consensus.nPowTargetSpacing = 10 * 60;
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = false;
pchMessageStart[0] = 0x55;
pchMessageStart[1] = 0x61;
pchMessageStart[2] = 0xe4;
pchMessageStart[3] = 0x88;
vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
nDefaultPort = 28333;
nMaxTipAge = 0x7fffffff;
nPruneAfterHeight = 1000;

genesis = CreateGenesisBlock(1451529527, 414098458, 0x1d00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();

vFixedSeeds.clear();
vSeeds.clear();

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,30);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,50);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,158);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x05)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x05)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();

vFixedSeeds.clear();

fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = false;
fMineBlocksOnDemand = false;
fTestnetToBeDeprecatedFieldRPC = true;

// checkpointData is empty
}
};
static CSegNetParams segNetParams;

/**
* Regression test
*/
Expand Down Expand Up @@ -282,6 +335,8 @@ CChainParams& Params(const std::string& chain)
return mainParams;
else if (chain == CBaseChainParams::TESTNET)
return testNetParams;
else if (chain == CBaseChainParams::SEGNET)
return segNetParams;
else if (chain == CBaseChainParams::REGTEST)
return regTestParams;
else
Expand Down
24 changes: 22 additions & 2 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
const std::string CBaseChainParams::MAIN = "main";
const std::string CBaseChainParams::TESTNET = "test";
const std::string CBaseChainParams::REGTEST = "regtest";
const std::string CBaseChainParams::SEGNET = "segnet";

void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp)
{
Expand Down Expand Up @@ -51,6 +52,20 @@ class CBaseTestNetParams : public CBaseChainParams
};
static CBaseTestNetParams testNetParams;

/**
* Segnet
*/
class CBaseSegNetParams : public CBaseChainParams
{
public:
CBaseSegNetParams()
{
nRPCPort = 28332;
strDataDir = "segnet";
}
};
static CBaseSegNetParams segNetParams;

/*
* Regression test
*/
Expand Down Expand Up @@ -79,6 +94,8 @@ CBaseChainParams& BaseParams(const std::string& chain)
return mainParams;
else if (chain == CBaseChainParams::TESTNET)
return testNetParams;
else if (chain == CBaseChainParams::SEGNET)
return segNetParams;
else if (chain == CBaseChainParams::REGTEST)
return regTestParams;
else
Expand All @@ -94,13 +111,16 @@ std::string ChainNameFromCommandLine()
{
bool fRegTest = GetBoolArg("-regtest", false);
bool fTestNet = GetBoolArg("-testnet", false);
bool fSegNet = GetBoolArg("-segnet", false);

if (fTestNet && fRegTest)
throw std::runtime_error("Invalid combination of -regtest and -testnet.");
if ((int)fRegTest + (int)fTestNet + (int)fSegNet > 1)
throw std::runtime_error("Invalid combination of -regtest, -testnet, -segnet.");
if (fRegTest)
return CBaseChainParams::REGTEST;
if (fTestNet)
return CBaseChainParams::TESTNET;
if (fSegNet)
return CBaseChainParams::SEGNET;
return CBaseChainParams::MAIN;
}

Expand Down
1 change: 1 addition & 0 deletions src/chainparamsbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CBaseChainParams
static const std::string MAIN;
static const std::string TESTNET;
static const std::string REGTEST;
static const std::string SEGNET;

const std::string& DataDir() const { return strDataDir; }
int RPCPort() const { return nRPCPort; }
Expand Down

0 comments on commit a1c4143

Please sign in to comment.