Closes #2637. Make z_shieldcoinbase an experimental feature where it

can be enabled with: zcashd -experimentalfeatures -zshieldcoinbase.
This commit is contained in:
Simon
2017-09-27 10:27:50 -07:00
parent 14148301e6
commit 5023af7bd5
3 changed files with 15 additions and 2 deletions

View File

@@ -3525,9 +3525,16 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
bool fEnableShieldCoinbase = fExperimentalMode && GetBoolArg("-zshieldcoinbase", false);
std::string strDisabledMsg = "";
if (!fEnableShieldCoinbase) {
strDisabledMsg = "\nWARNING: z_shieldcoinbase is DISABLED but can be enabled as an experimental feature.\n";
}
if (fHelp || params.size() < 2 || params.size() > 3)
throw runtime_error(
"z_shieldcoinbase \"fromaddress\" \"tozaddress\" ( fee )\n"
+ strDisabledMsg +
"\nShield transparent coinbase funds by sending to a shielded zaddr. This is an asynchronous operation and utxos"
"\nselected for shielding will be locked. If there is an error, they are unlocked. The RPC call `listlockunspent`"
"\ncan be used to return a list of locked utxos. The number of coinbase utxos selected for shielding is limited by"
@@ -3549,6 +3556,10 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
"}\n"
);
if (!fEnableShieldCoinbase) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: z_shieldcoinbase is disabled.");
}
LOCK2(cs_main, pwalletMain->cs_wallet);
// Validate the from address