mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Merge pull request #6645
77c6072
Enable wallet key imports without rescan in pruned mode. (Gregory Maxwell)
This commit is contained in:
commit
4dbd43ed0a
@ -97,8 +97,6 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
|
|||||||
+ HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
|
+ HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fPruneMode)
|
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Importing keys is disabled in pruned mode");
|
|
||||||
|
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||||
|
|
||||||
@ -114,6 +112,9 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
|
|||||||
if (params.size() > 2)
|
if (params.size() > 2)
|
||||||
fRescan = params[2].get_bool();
|
fRescan = params[2].get_bool();
|
||||||
|
|
||||||
|
if (fRescan && fPruneMode)
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
||||||
|
|
||||||
CBitcoinSecret vchSecret;
|
CBitcoinSecret vchSecret;
|
||||||
bool fGood = vchSecret.SetString(strSecret);
|
bool fGood = vchSecret.SetString(strSecret);
|
||||||
|
|
||||||
@ -201,8 +202,6 @@ UniValue importaddress(const UniValue& params, bool fHelp)
|
|||||||
+ HelpExampleRpc("importaddress", "\"myscript\", \"testing\", false")
|
+ HelpExampleRpc("importaddress", "\"myscript\", \"testing\", false")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fPruneMode)
|
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Importing addresses is disabled in pruned mode");
|
|
||||||
|
|
||||||
string strLabel = "";
|
string strLabel = "";
|
||||||
if (params.size() > 1)
|
if (params.size() > 1)
|
||||||
@ -213,6 +212,9 @@ UniValue importaddress(const UniValue& params, bool fHelp)
|
|||||||
if (params.size() > 2)
|
if (params.size() > 2)
|
||||||
fRescan = params[2].get_bool();
|
fRescan = params[2].get_bool();
|
||||||
|
|
||||||
|
if (fRescan && fPruneMode)
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
||||||
|
|
||||||
// Whether to import a p2sh version, too
|
// Whether to import a p2sh version, too
|
||||||
bool fP2SH = false;
|
bool fP2SH = false;
|
||||||
if (params.size() > 3)
|
if (params.size() > 3)
|
||||||
@ -264,8 +266,6 @@ UniValue importpubkey(const UniValue& params, bool fHelp)
|
|||||||
+ HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false")
|
+ HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fPruneMode)
|
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Importing public keys is disabled in pruned mode");
|
|
||||||
|
|
||||||
string strLabel = "";
|
string strLabel = "";
|
||||||
if (params.size() > 1)
|
if (params.size() > 1)
|
||||||
@ -276,6 +276,9 @@ UniValue importpubkey(const UniValue& params, bool fHelp)
|
|||||||
if (params.size() > 2)
|
if (params.size() > 2)
|
||||||
fRescan = params[2].get_bool();
|
fRescan = params[2].get_bool();
|
||||||
|
|
||||||
|
if (fRescan && fPruneMode)
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
||||||
|
|
||||||
if (!IsHex(params[0].get_str()))
|
if (!IsHex(params[0].get_str()))
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey must be a hex string");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey must be a hex string");
|
||||||
std::vector<unsigned char> data(ParseHex(params[0].get_str()));
|
std::vector<unsigned char> data(ParseHex(params[0].get_str()));
|
||||||
|
Loading…
Reference in New Issue
Block a user