Browse Source

Properly fixed testnet checking.

cn v0.16.3-rc1
Jianping Wu 6 years ago
parent
commit
166d96ea1c
  1. 8
      src/bitcoin-cli.cpp
  2. 8
      src/bitcoind.cpp
  3. 4
      src/chainparams.cpp
  4. 6
      src/init.cpp

8
src/bitcoin-cli.cpp

@ -112,6 +112,14 @@ static int AppInitRPC(int argc, char* argv[]) @@ -112,6 +112,14 @@ static int AppInitRPC(int argc, char* argv[])
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return EXIT_FAILURE;
}
#if 1
if (ChainNameFromCommandLine() == CBaseChainParams::MAIN) {
printf("\nMainnet is not live yet, use \"-testnet\" option to connect to the testnet.\n\n");
exit(1);
}
#endif
// Check for -testnet or -regtest parameter (BaseParams() calls are only valid after this clause)
try {
SelectBaseParams(ChainNameFromCommandLine());

8
src/bitcoind.cpp

@ -100,6 +100,14 @@ bool AppInit(int argc, char* argv[]) @@ -100,6 +100,14 @@ bool AppInit(int argc, char* argv[])
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return false;
}
#if 1
if (ChainNameFromCommandLine() == CBaseChainParams::MAIN) {
printf("\nMainnet is not live yet, use \"-testnet\" option to connect to the testnet.\n\n");
exit(1);
}
#endif
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
try {
SelectParams(ChainNameFromCommandLine());

4
src/chainparams.cpp

@ -116,10 +116,6 @@ public: @@ -116,10 +116,6 @@ public:
//TODO: target: 0x1e0fffff, update timestampe and nonce.
genesis = CreateGenesisBlock(1543789622, 3302, 0x1f0ffff0, 1, genesisBlockReward);
#if 1
printf("\nMainnet is not live yet, use -testnet to connect to the testnet.\n\n");
exit(1);
#endif
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x77c037d74bc51b535629537c8e9530340ea12272f43d261a0ee59e8f2ad0e6f6"));
assert(genesis.hashMerkleRoot == uint256S("0xb21d4680875c0e472b7dbf3dbab2aaeb2dbbb5fa8b154f978b5ea0706d1fd5b9"));

6
src/init.cpp

@ -1461,6 +1461,12 @@ bool AppInitMain() @@ -1461,6 +1461,12 @@ bool AppInitMain()
break;
}
#if 1
if (ChainNameFromCommandLine() == CBaseChainParams::MAIN) {
return InitError(_("Mainnet is not live yet, use \"-testnet\" option to connect to the testnet."));
}
#endif
// If the loaded chain has a wrong genesis, bail out immediately
// (we're likely using a testnet datadir, or the other way around).
if (!mapBlockIndex.empty() && mapBlockIndex.count(chainparams.GetConsensus().hashGenesisBlock) == 0)

Loading…
Cancel
Save