Auto merge of #4178 - oxarbitrage:issue3731, r=str4d

Remove z_mergetoaddress from experimental state

Closes #3731.
This commit is contained in:
Homu 2019-11-11 01:57:21 -08:00
commit fd8444d0b7
7 changed files with 5 additions and 35 deletions

View File

@ -41,12 +41,12 @@ class MergeToAddressHelper:
initialize_chain_clean(test.options.tmpdir, 4)
def setup_network(self, test, additional_args=[]):
args = ['-debug=zrpcunsafe', '-experimentalfeatures', '-zmergetoaddress']
args = ['-debug=zrpcunsafe']
args += additional_args
test.nodes = []
test.nodes.append(start_node(0, test.options.tmpdir, args))
test.nodes.append(start_node(1, test.options.tmpdir, args))
args2 = ['-debug=zrpcunsafe', '-experimentalfeatures', '-zmergetoaddress', '-mempooltxinputlimit=7']
args2 = ['-debug=zrpcunsafe', '-mempooltxinputlimit=7']
args2 += additional_args
test.nodes.append(start_node(2, test.options.tmpdir, args2))
connect_nodes_bi(test.nodes, 0, 1)

View File

@ -14,9 +14,7 @@ from mergetoaddress_helper import assert_mergetoaddress_exception
class MergeToAddressMixedNotes(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(4, self.options.tmpdir, [[
'-experimentalfeatures', '-zmergetoaddress'
]] * 4)
return start_nodes(4, self.options.tmpdir)
def setup_chain(self):
print("Initializing test directory " + self.options.tmpdir)

View File

@ -27,8 +27,7 @@ class WalletChangeAddressesTest(BitcoinTestFramework):
args = [
'-nuparams=5ba81b19:1', # Overwinter
'-nuparams=76b809bb:1', # Sapling
'-txindex', # Avoid JSONRPC error: No information available about transaction
'-experimentalfeatures', '-zmergetoaddress',
'-txindex' # Avoid JSONRPC error: No information available about transaction
]
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, args))

View File

@ -20,9 +20,7 @@ from decimal import Decimal
class WalletSaplingTest(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(4, self.options.tmpdir, [[
'-experimentalfeatures', '-zmergetoaddress',
]] * 4)
return start_nodes(4, self.options.tmpdir)
def run_test(self):
# Sanity-check the test harness

View File

@ -848,8 +848,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(_("Setting the size of shielded pools to zero requires -experimentalfeatures."));
} else if (mapArgs.count("-paymentdisclosure")) {
return InitError(_("Payment disclosure requires -experimentalfeatures."));
} else if (mapArgs.count("-zmergetoaddress")) {
return InitError(_("RPC method z_mergetoaddress requires -experimentalfeatures."));
} else if (mapArgs.count("-insightexplorer")) {
return InitError(_("Insight explorer requires -experimentalfeatures."));
}

View File

@ -1686,13 +1686,6 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_parameters)
LOCK(pwalletMain->cs_wallet);
CheckRPCThrows("z_mergetoaddress 1 2",
"Error: z_mergetoaddress is disabled. Run './zcash-cli help z_mergetoaddress' for instructions on how to enable this feature.");
// Set global state required for z_mergetoaddress
fExperimentalMode = true;
mapArgs["-zmergetoaddress"] = "1";
BOOST_CHECK_THROW(CallRPC("z_mergetoaddress"), runtime_error);
BOOST_CHECK_THROW(CallRPC("z_mergetoaddress toofewargs"), runtime_error);
BOOST_CHECK_THROW(CallRPC("z_mergetoaddress just too many args present for this method"), runtime_error);
@ -1830,10 +1823,6 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_parameters)
} catch (const UniValue& objError) {
BOOST_CHECK( find_error(objError, "Invalid recipient address"));
}
// Un-set global state
fExperimentalMode = false;
mapArgs.erase("-zmergetoaddress");
}

View File

@ -4262,17 +4262,9 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
string enableArg = "zmergetoaddress";
auto fEnableMergeToAddress = fExperimentalMode && GetBoolArg("-" + enableArg, false);
std::string strDisabledMsg = "";
if (!fEnableMergeToAddress) {
strDisabledMsg = experimentalDisabledHelpMsg("z_mergetoaddress", enableArg);
}
if (fHelp || params.size() < 2 || params.size() > 6)
throw runtime_error(
"z_mergetoaddress [\"fromaddress\", ... ] \"toaddress\" ( fee ) ( transparent_limit ) ( shielded_limit ) ( memo )\n"
+ strDisabledMsg +
"\nMerge multiple UTXOs and notes into a single UTXO or note. Coinbase UTXOs are ignored; use `z_shieldcoinbase`"
"\nto combine those into a single note."
"\n\nThis is an asynchronous operation, and UTXOs selected for merging will be locked. If there is an error, they"
@ -4323,10 +4315,6 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
+ HelpExampleRpc("z_mergetoaddress", "[\"ANY_SAPLING\", \"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\"], \"ztestsapling19rnyu293v44f0kvtmszhx35lpdug574twc0lwyf4s7w0umtkrdq5nfcauxrxcyfmh3m7slemqsj\"")
);
if (!fEnableMergeToAddress) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: z_mergetoaddress is disabled. Run './zcash-cli help z_mergetoaddress' for instructions on how to enable this feature.");
}
LOCK2(cs_main, pwalletMain->cs_wallet);
bool useAnyUTXO = false;