Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag for enabling experimental features #2056

Merged
merged 2 commits into from Feb 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion qa/rpc-tests/keypool.py
Expand Up @@ -98,7 +98,7 @@ def main():
os.makedirs(options.tmpdir)
initialize_chain(options.tmpdir)

nodes = start_nodes(1, options.tmpdir, extra_args=[['-developerencryptwallet']])
nodes = start_nodes(1, options.tmpdir, extra_args=[['-experimentalfeatures', '-developerencryptwallet']])

run_test(nodes, options.tmpdir)

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/wallet_nullifiers.py
Expand Up @@ -12,7 +12,7 @@ class WalletNullifiersTest (BitcoinTestFramework):

def setup_nodes(self):
return start_nodes(4, self.options.tmpdir,
extra_args=[['-developerencryptwallet']] * 4)
extra_args=[['-experimentalfeatures', '-developerencryptwallet']] * 4)

def run_test (self):
# add zaddr to node 0
Expand Down
11 changes: 11 additions & 0 deletions src/init.cpp
Expand Up @@ -416,6 +416,7 @@ std::string HelpMessage(HelpMessageMode mode)
debugCategories += ", qt";
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + debugCategories + ".");
strUsage += HelpMessageOpt("-experimentalfeatures", _("Enable use of experimental features"));
strUsage += HelpMessageOpt("-help-debug", _("Show all debugging options (usage: --help -help-debug)"));
strUsage += HelpMessageOpt("-logips", strprintf(_("Include IP addresses in debug output (default: %u)"), 0));
strUsage += HelpMessageOpt("-logtimestamps", strprintf(_("Prepend debug output with timestamp (default: %u)"), 1));
Expand Down Expand Up @@ -750,6 +751,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 2: parameter interactions
const CChainParams& chainparams = Params();

// Set this early so that experimental features are correctly enabled/disabled
fExperimentalMode = GetBoolArg("-experimentalfeatures", false);

// Fail early if user has set experimental options without the global flag
if (!fExperimentalMode) {
if (mapArgs.count("-developerencryptwallet")) {
return InitError(_("Wallet encryption requires -experimentalfeatures."));
}
}

// Set this early so that parameter interactions go to console
fPrintToConsole = GetBoolArg("-printtoconsole", false);
fLogTimestamps = GetBoolArg("-logtimestamps", true);
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Expand Up @@ -56,6 +56,7 @@ int64_t nTimeBestReceived = 0;
CWaitableCriticalSection csBestBlock;
CConditionVariable cvBlockChange;
int nScriptCheckThreads = 0;
bool fExperimentalMode = false;
bool fImporting = false;
bool fReindex = false;
bool fTxIndex = false;
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Expand Up @@ -116,6 +116,7 @@ extern uint64_t nLastBlockSize;
extern const std::string strMessageMagic;
extern CWaitableCriticalSection csBestBlock;
extern CConditionVariable cvBlockChange;
extern bool fExperimentalMode;
extern bool fImporting;
extern bool fReindex;
extern int nScriptCheckThreads;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Expand Up @@ -2002,7 +2002,7 @@ Value encryptwallet(const Array& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return Value::null;

auto fEnableWalletEncryption = GetBoolArg("-developerencryptwallet", false);
auto fEnableWalletEncryption = fExperimentalMode && GetBoolArg("-developerencryptwallet", false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This silently ignores -developerencryptwallet when not in experimental mode. It should give an error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise ut(ACK+cov).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you mean there should be an error saying "please enable -experimentalfeatures".

Copy link
Contributor

@daira daira Feb 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the check here, this change is no longer required. Does not block.


std::string strWalletEncryptionDisabledMsg = "";
if (!fEnableWalletEncryption) {
Expand Down