Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | UniValue importaddress(const Config &config, const JSONRPCRequest &request) { | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 4) { | 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 " | "\nAdds an address or script (in hex) that can be watched as if it " | ||||
"were in your wallet but cannot be used to spend. Requires a new " | "were in your wallet but cannot be used to spend. Requires a new " | ||||
"wallet backup.\n" | "wallet backup.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"script\" (string, required) The hex-encoded script " | "1. \"address\" (string, required) The Bitcoin address " | ||||
"(or address)\n" | "(or hex-encoded script)\n" | ||||
"2. \"label\" (string, optional, default=\"\") An " | "2. \"label\" (string, optional, default=\"\") An " | ||||
"optional label\n" | "optional label\n" | ||||
"3. rescan (boolean, optional, default=true) Rescan " | "3. rescan (boolean, optional, default=true) Rescan " | ||||
"the wallet for transactions\n" | "the wallet for transactions\n" | ||||
"4. p2sh (boolean, optional, default=false) Add " | "4. p2sh (boolean, optional, default=false) Add " | ||||
"the P2SH version of the script as well\n" | "the P2SH version of the script as well\n" | ||||
"\nNote: This call can take minutes to complete if rescan is true, " | "\nNote: This call can take minutes to complete if rescan is true, " | ||||
"during that time, other rpc calls\n" | "during that time, other rpc calls\n" | ||||
"may report that the imported address exists but related " | "may report that the imported address exists but related " | ||||
"transactions are still missing, leading to temporarily " | "transactions are still missing, leading to temporarily " | ||||
"incorrect/bogus balances and unspent outputs until rescan " | "incorrect/bogus balances and unspent outputs until rescan " | ||||
"completes.\n" | "completes.\n" | ||||
"If you have the full public key, you should call importpubkey " | "If you have the full public key, you should call importpubkey " | ||||
"instead of this.\n" | "instead of this.\n" | ||||
"\nNote: If you import a non-standard raw script in hex form, " | "\nNote: If you import a non-standard raw script in hex form, " | ||||
"outputs sending to it will be treated\n" | "outputs sending to it will be treated\n" | ||||
"as change, and not show up in many RPCs.\n" | "as change, and not show up in many RPCs.\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nImport a script with rescan\n" + | "\nImport an address with rescan\n" + | ||||
HelpExampleCli("importaddress", "\"myscript\"") + | HelpExampleCli("importaddress", "\"myaddress\"") + | ||||
"\nImport using a label without rescan\n" + | "\nImport using a label without rescan\n" + | ||||
HelpExampleCli("importaddress", "\"myscript\" \"testing\" false") + | HelpExampleCli("importaddress", "\"myaddress\" \"testing\" false") + | ||||
"\nAs a JSON-RPC call\n" + | "\nAs a JSON-RPC call\n" + | ||||
HelpExampleRpc("importaddress", | HelpExampleRpc("importaddress", | ||||
"\"myscript\", \"testing\", false")); | "\"myaddress\", \"testing\", false")); | ||||
} | } | ||||
std::string strLabel; | std::string strLabel; | ||||
if (!request.params[1].isNull()) { | if (!request.params[1].isNull()) { | ||||
strLabel = request.params[1].get_str(); | strLabel = request.params[1].get_str(); | ||||
} | } | ||||
// Whether to perform rescan after import | // Whether to perform rescan after import | ||||
▲ Show 20 Lines • Show All 1,188 Lines • Show Last 20 Lines |