Merge #11289: Add wallet backup text to import* and add* RPCs

c098c58 Wrap dumpwallet warning and note scripts aren't dumped (MeshCollider)
a38bfbc Add wallet backup text to import*, add* and dumpwallet RPCs (MeshCollider)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/11243

  Adds "Requires a new wallet backup" text to `addwitnessaddress`, `importprivkey`, `importmulti`, `importaddress`, `importpubkey`, and `addmultisigaddress`. Also adds a warning to `dumpwallet` that backing up the seed alone is not sufficient to back up non-HD addresses

Tree-SHA512: 76d7cdca54d5b458acf479154620322391b889922525fddd6153f4164cfee393ad743757400cb8f6b1b30f24947df68ea9043b4e509f7df77a8fa05dda370933
This commit is contained in:
Wladimir J. van der Laan 2017-11-08 09:55:40 +01:00 committed by Alexander Block
parent d7119e6487
commit 617c886233
2 changed files with 9 additions and 6 deletions

View File

@ -81,7 +81,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"importprivkey \"privkey\" ( \"label\" ) ( rescan )\n" "importprivkey \"privkey\" ( \"label\" ) ( rescan )\n"
"\nAdds a private key (as returned by dumpprivkey) to your wallet.\n" "\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"privkey\" (string, required) The private key (see dumpprivkey)\n" "1. \"privkey\" (string, required) The private key (see dumpprivkey)\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n" "2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -225,7 +225,7 @@ UniValue importaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"importaddress \"address\" ( \"label\" rescan p2sh )\n" "importaddress \"address\" ( \"label\" rescan p2sh )\n"
"\nAdds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.\n" "\nAdds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"script\" (string, required) The hex-encoded script (or address)\n" "1. \"script\" (string, required) The hex-encoded script (or address)\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n" "2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -394,7 +394,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"importpubkey \"pubkey\" ( \"label\" rescan )\n" "importpubkey \"pubkey\" ( \"label\" rescan )\n"
"\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.\n" "\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"pubkey\" (string, required) The hex-encoded public key\n" "1. \"pubkey\" (string, required) The hex-encoded public key\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n" "2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -454,7 +454,7 @@ UniValue importwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"importwallet \"filename\"\n" "importwallet \"filename\"\n"
"\nImports keys from a wallet dump file (see dumpwallet).\n" "\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"filename\" (string, required) The wallet file\n" "1. \"filename\" (string, required) The wallet file\n"
"\nExamples:\n" "\nExamples:\n"
@ -775,6 +775,9 @@ UniValue dumpwallet(const JSONRPCRequest& request)
throw std::runtime_error( throw std::runtime_error(
"dumpwallet \"filename\"\n" "dumpwallet \"filename\"\n"
"\nDumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.\n" "\nDumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.\n"
"Imported scripts are not currently included in wallet dumps, these must be backed up separately.\n"
"Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by\n"
"only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"filename\" (string, required) The filename\n" "1. \"filename\" (string, required) The filename\n"
"\nExamples:\n" "\nExamples:\n"
@ -1247,7 +1250,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2) if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"importmulti \"requests\" ( \"options\" )\n\n" "importmulti \"requests\" ( \"options\" )\n\n"
"Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options).\n\n" "Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options). Requires a new wallet backup.\n\n"
"Arguments:\n" "Arguments:\n"
"1. requests (array, required) Data to be imported\n" "1. requests (array, required) Data to be imported\n"
" [ (array of json objects)\n" " [ (array of json objects)\n"

View File

@ -1133,7 +1133,7 @@ UniValue addmultisigaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
{ {
std::string msg = "addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n" std::string msg = "addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n"
"\nAdd a nrequired-to-sign multisignature address to the wallet.\n" "\nAdd a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n"
"Each key is a Dash address or hex-encoded public key.\n" "Each key is a Dash address or hex-encoded public key.\n"
"If 'account' is specified (DEPRECATED), assign address to that account.\n" "If 'account' is specified (DEPRECATED), assign address to that account.\n"