|
|
@ -1,4 +1,5 @@ |
|
|
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
|
|
|
// Copyright (c) 2017 The Hush developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
@ -80,10 +81,10 @@ UniValue importprivkey(const UniValue& params, bool fHelp) |
|
|
|
|
|
|
|
if (fHelp || params.size() < 1 || params.size() > 3) |
|
|
|
throw runtime_error( |
|
|
|
"importprivkey \"zcashprivkey\" ( \"label\" rescan )\n" |
|
|
|
"importprivkey \"hushprivkey\" ( \"label\" rescan )\n" |
|
|
|
"\nAdds a private key (as returned by dumpprivkey) to your wallet.\n" |
|
|
|
"\nArguments:\n" |
|
|
|
"1. \"zcashprivkey\" (string, required) The private key (see dumpprivkey)\n" |
|
|
|
"1. \"hushprivkey\" (string, required) The private key (see dumpprivkey)\n" |
|
|
|
"2. \"label\" (string, optional, default=\"\") An optional label\n" |
|
|
|
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" |
|
|
|
"\nNote: This call can take minutes to complete if rescan is true.\n" |
|
|
@ -181,7 +182,7 @@ UniValue importaddress(const UniValue& params, bool fHelp) |
|
|
|
std::vector<unsigned char> data(ParseHex(params[0].get_str())); |
|
|
|
script = CScript(data.begin(), data.end()); |
|
|
|
} else { |
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address or script"); |
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address or script"); |
|
|
|
} |
|
|
|
|
|
|
|
string strLabel = ""; |
|
|
@ -297,7 +298,7 @@ UniValue importwallet_impl(const UniValue& params, bool fHelp, bool fImportZKeys |
|
|
|
if (vstr.size() < 2) |
|
|
|
continue; |
|
|
|
|
|
|
|
// Let's see if the address is a valid Zcash spending key
|
|
|
|
// Let's see if the address is a valid Hush spending key
|
|
|
|
if (fImportZKeys) { |
|
|
|
try { |
|
|
|
CZCSpendingKey spendingkey(vstr[0]); |
|
|
@ -391,7 +392,7 @@ UniValue dumpprivkey(const UniValue& params, bool fHelp) |
|
|
|
"\nReveals the private key corresponding to 'hushaddress'.\n" |
|
|
|
"Then the importprivkey can be used with this output\n" |
|
|
|
"\nArguments:\n" |
|
|
|
"1. \"hushaddress\" (string, required) The zcash address for the private key\n" |
|
|
|
"1. \"hushaddress\" (string, required) The hush address for the private key\n" |
|
|
|
"\nResult:\n" |
|
|
|
"\"key\" (string) The private key\n" |
|
|
|
"\nExamples:\n" |
|
|
@ -407,7 +408,7 @@ UniValue dumpprivkey(const UniValue& params, bool fHelp) |
|
|
|
string strAddress = params[0].get_str(); |
|
|
|
CBitcoinAddress address; |
|
|
|
if (!address.SetString(strAddress)) |
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address"); |
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid hush address"); |
|
|
|
CKeyID keyID; |
|
|
|
if (!address.GetKeyID(keyID)) |
|
|
|
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key"); |
|
|
@ -502,7 +503,7 @@ UniValue dumpwallet_impl(const UniValue& params, bool fHelp, bool fDumpZKeys) |
|
|
|
std::sort(vKeyBirth.begin(), vKeyBirth.end()); |
|
|
|
|
|
|
|
// produce output
|
|
|
|
file << strprintf("# Wallet dump created by Zcash %s (%s)\n", CLIENT_BUILD, CLIENT_DATE); |
|
|
|
file << strprintf("# Wallet dump created by Hush %s (%s)\n", CLIENT_BUILD, CLIENT_DATE); |
|
|
|
file << strprintf("# * Created on %s\n", EncodeDumpTime(GetTime())); |
|
|
|
file << strprintf("# * Best block at time of backup was %i (%s),\n", chainActive.Height(), chainActive.Tip()->GetBlockHash().ToString()); |
|
|
|
file << strprintf("# mined on %s\n", EncodeDumpTime(chainActive.Tip()->GetBlockTime())); |
|
|
|