Skip to content

Commit

Permalink
Disable mainnet/testnet operation
Browse files Browse the repository at this point in the history
To avoid the risk of bugs in new consensus code causing potential
chain splits or loss of funds, we disable use of this branch on mainnet
or testnet.  Use with either regtest or signet remains supported.
  • Loading branch information
ajtowns committed May 22, 2022
1 parent fcf6c8f commit 3d1c9f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
} catch (const std::exception& e) {
return InitError(Untranslated(strprintf("%s\n", e.what())));
}
// Disallow mainnet/testnet operation
if (Params().NetworkIDString() == CBaseChainParams::MAIN || Params().NetworkIDString() == CBaseChainParams::TESTNET) {
return InitError(Untranslated(strprintf("Selected network '%s' is unsupported for this client, select -regtest or -signet instead.\n", Params().NetworkIDString())));
}

// Error out when loose non-argument tokens are encountered on command line
for (int i = 1; i < argc; i++) {
Expand Down
5 changes: 5 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ int GuiMain(int argc, char* argv[])
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
return EXIT_FAILURE;
}
// Disallow mainnet/testnet operation
if (Params().NetworkIDString() == CBaseChainParams::MAIN || Params().NetworkIDString() == CBaseChainParams::TESTNET) {
return InitError(Untranslated(strprintf("Selected network '%s' is unsupported for this client, select -regtest or -signet instead.\n", Params().NetworkIDString())));
}

#ifdef ENABLE_WALLET
// Parse URIs on command line -- this can affect Params()
PaymentServer::ipcParseCommandLine(argc, argv);
Expand Down

0 comments on commit 3d1c9f3

Please sign in to comment.