Browse Source
Gate z_mergetoaddress as an experimental feature
pull/4/head
Jack Grigg
6 years ago
No known key found for this signature in database
GPG Key ID: 665DBCD284F7DAFF
3 changed files with
15 additions and
2 deletions
-
qa/rpc-tests/wallet_mergetoaddress.py
-
src/init.cpp
-
src/wallet/rpcwallet.cpp
|
|
@ -19,11 +19,11 @@ class WalletMergeToAddressTest (BitcoinTestFramework): |
|
|
|
initialize_chain_clean(self.options.tmpdir, 4) |
|
|
|
|
|
|
|
def setup_network(self, split=False): |
|
|
|
args = ['-debug=zrpcunsafe'] |
|
|
|
args = ['-debug=zrpcunsafe', '-experimentalfeatures', '-zmergetoaddress'] |
|
|
|
self.nodes = [] |
|
|
|
self.nodes.append(start_node(0, self.options.tmpdir, args)) |
|
|
|
self.nodes.append(start_node(1, self.options.tmpdir, args)) |
|
|
|
args2 = ['-debug=zrpcunsafe', '-mempooltxinputlimit=7'] |
|
|
|
args2 = ['-debug=zrpcunsafe', '-experimentalfeatures', '-zmergetoaddress', '-mempooltxinputlimit=7'] |
|
|
|
self.nodes.append(start_node(2, self.options.tmpdir, args2)) |
|
|
|
connect_nodes_bi(self.nodes,0,1) |
|
|
|
connect_nodes_bi(self.nodes,1,2) |
|
|
|
|
|
@ -793,6 +793,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
} |
|
|
|
else if (mapArgs.count("-paymentdisclosure")) { |
|
|
|
return InitError(_("Payment disclosure requires -experimentalfeatures.")); |
|
|
|
} else if (mapArgs.count("-zmergetoaddress")) { |
|
|
|
return InitError(_("RPC method z_mergetoaddress requires -experimentalfeatures.")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -3759,9 +3759,16 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) |
|
|
|
if (!EnsureWalletIsAvailable(fHelp)) |
|
|
|
return NullUniValue; |
|
|
|
|
|
|
|
auto fEnableMergeToAddress = fExperimentalMode && GetBoolArg("-zmergetoaddress", false); |
|
|
|
std::string strDisabledMsg = ""; |
|
|
|
if (!fEnableMergeToAddress) { |
|
|
|
strDisabledMsg = "\nWARNING: z_mergetoaddress is DISABLED but can be enabled as an experimental feature.\n"; |
|
|
|
} |
|
|
|
|
|
|
|
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" |
|
|
@ -3807,6 +3814,10 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) |
|
|
|
+ HelpExampleRpc("z_mergetoaddress", "[\"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\"], \"ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf\"") |
|
|
|
); |
|
|
|
|
|
|
|
if (!fEnableMergeToAddress) { |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error: z_mergetoaddress is disabled."); |
|
|
|
} |
|
|
|
|
|
|
|
LOCK2(cs_main, pwalletMain->cs_wallet); |
|
|
|
|
|
|
|
bool useAny = false; |
|
|
|