Skip to content

Commit ab7293c

Browse files
committed
Disable mainnet/testnet operation
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.
1 parent fcf6c8f commit ab7293c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/bitcoind.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
161161
} catch (const std::exception& e) {
162162
return InitError(Untranslated(strprintf("%s\n", e.what())));
163163
}
164+
// Disallow mainnet/testnet operation
165+
if (Params().NetworkIDString() == CBaseChainParams::MAIN || Params().NetworkIDString() == CBaseChainParams::TESTNET) {
166+
return InitError(Untranslated(strprintf("Selected network '%s' is unsupported for this client, select -regtest or -signet instead.\n", Params().NetworkIDString())));
167+
}
164168

165169
// Error out when loose non-argument tokens are encountered on command line
166170
for (int i = 1; i < argc; i++) {

src/qt/bitcoin.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ int GuiMain(int argc, char* argv[])
586586
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
587587
return EXIT_FAILURE;
588588
}
589+
// Disallow mainnet/testnet operation
590+
if (Params().NetworkIDString() == CBaseChainParams::MAIN || Params().NetworkIDString() == CBaseChainParams::TESTNET) {
591+
return InitError(Untranslated(strprintf("Selected network '%s' is unsupported for this client, select -regtest or -signet instead.\n", Params().NetworkIDString())));
592+
}
593+
589594
#ifdef ENABLE_WALLET
590595
// Parse URIs on command line -- this can affect Params()
591596
PaymentServer::ipcParseCommandLine(argc, argv);

0 commit comments

Comments
 (0)