|
|
@ -165,14 +165,14 @@ Value importaddress(const Array& params, bool fHelp) |
|
|
|
std::vector<unsigned char> data(ParseHex(params[0].get_str())); |
|
|
|
std::vector<unsigned char> data(ParseHex(params[0].get_str())); |
|
|
|
script = CScript(data.begin(), data.end()); |
|
|
|
script = CScript(data.begin(), data.end()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address or script"); |
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address or script"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
string strLabel = ""; |
|
|
|
string strLabel = ""; |
|
|
|
if (params.size() > 1) |
|
|
|
if (params.size() > 1) |
|
|
|
strLabel = params[1].get_str(); |
|
|
|
strLabel = params[1].get_str(); |
|
|
|
|
|
|
|
|
|
|
|
// Whether to perform rescan after import
|
|
|
|
// Whether to perform rescan after import
|
|
|
|
bool fRescan = true; |
|
|
|
bool fRescan = true; |
|
|
|
if (params.size() > 2) |
|
|
|
if (params.size() > 2) |
|
|
|
fRescan = params[2].get_bool(); |
|
|
|
fRescan = params[2].get_bool(); |
|
|
@ -191,7 +191,7 @@ Value importaddress(const Array& params, bool fHelp) |
|
|
|
pwalletMain->MarkDirty(); |
|
|
|
pwalletMain->MarkDirty(); |
|
|
|
|
|
|
|
|
|
|
|
if (!pwalletMain->AddWatchOnly(script)) |
|
|
|
if (!pwalletMain->AddWatchOnly(script)) |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); |
|
|
|
|
|
|
|
|
|
|
|
if (fRescan) |
|
|
|
if (fRescan) |
|
|
|
{ |
|
|
|
{ |
|
|
|