Skip to content

Commit 6f8b198

Browse files
committed
[p2p] remove unused segwitheight=-1 option
This also lets us default to NODE_WITNESS in nLocalServices
1 parent eba5b1c commit 6f8b198

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/chainparams.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,8 @@ void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args)
490490
{
491491
if (args.IsArgSet("-segwitheight")) {
492492
int64_t height = args.GetArg("-segwitheight", consensus.SegwitHeight);
493-
if (height < -1 || height >= std::numeric_limits<int>::max()) {
494-
throw std::runtime_error(strprintf("Activation height %ld for segwit is out of valid range. Use -1 to disable segwit.", height));
495-
} else if (height == -1) {
496-
LogPrintf("Segwit disabled for testing\n");
497-
height = std::numeric_limits<int>::max();
493+
if (height < 0 || height >= std::numeric_limits<int>::max()) {
494+
throw std::runtime_error(strprintf("Activation height %ld for segwit is out of valid range.", height));
498495
}
499496
consensus.SegwitHeight = static_cast<int>(height);
500497
}

src/chainparamsbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
2020
argsman.AddArg("-chain=<chain>", "Use the chain <chain> (default: main). Allowed values: main, test, signet, regtest", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2121
argsman.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
2222
"This is intended for regression testing tools and app development. Equivalent to -chain=regtest.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
23-
argsman.AddArg("-segwitheight=<n>", "Set the activation height of segwit. -1 to disable. (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
23+
argsman.AddArg("-segwitheight=<n>", "Set the activation height of segwit. (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
2424
argsman.AddArg("-testnet", "Use the test chain. Equivalent to -chain=test.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2525
argsman.AddArg("-vbparams=deployment:start:end[:min_activation_height]", "Use given start/end times and min_activation_height for specified version bits deployment (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2626
argsman.AddArg("-signet", "Use the signet chain. Equivalent to -chain=signet. Note that the network is defined by the -signetchallenge parameter", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);

src/init.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ namespace { // Variables internal to initialization process only
716716
int nMaxConnections;
717717
int nUserMaxConnections;
718718
int nFD;
719-
ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK | NODE_NETWORK_LIMITED);
719+
ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK | NODE_NETWORK_LIMITED | NODE_WITNESS);
720720
int64_t peer_connect_timeout;
721721
std::set<BlockFilterType> g_enabled_filter_types;
722722

@@ -1588,12 +1588,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15881588
}
15891589
}
15901590

1591-
if (DeploymentEnabled(chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) {
1592-
// Advertise witness capabilities.
1593-
// The option to not set NODE_WITNESS is only used in the tests and should be removed.
1594-
nLocalServices = ServiceFlags(nLocalServices | NODE_WITNESS);
1595-
}
1596-
15971591
// ********************************************************* Step 11: import blocks
15981592

15991593
if (!CheckDiskSpace(gArgs.GetDataDirNet())) {

0 commit comments

Comments
 (0)