mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
rpc: Bail out early when no wallet is available in rpcs that require it, even on help <cmd>
(#4123)
This commit is contained in:
parent
bf7b6adef2
commit
08ebd31fdb
@ -139,12 +139,12 @@ UniValue gobject_prepare(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (request.fHelp || (request.params.size() != 5 && request.params.size() != 6 && request.params.size() != 8))
|
||||
gobject_prepare_help(pwallet);
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || (request.params.size() != 5 && request.params.size() != 6 && request.params.size() != 8))
|
||||
gobject_prepare_help(pwallet);
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
// ASSEMBLE NEW GOVERNANCE OBJECT FROM USER PARAMETERS
|
||||
@ -247,13 +247,13 @@ UniValue gobject_list_prepared(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || (request.params.size() > 2)) {
|
||||
gobject_list_prepared_help(pwallet);
|
||||
}
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
int64_t nCount = request.params.size() > 1 ? ParseInt64V(request.params[1], "count") : 10;
|
||||
@ -574,12 +574,12 @@ UniValue gobject_vote_many(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (request.fHelp || request.params.size() != 4)
|
||||
gobject_vote_many_help(pwallet);
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || request.params.size() != 4)
|
||||
gobject_vote_many_help(pwallet);
|
||||
|
||||
uint256 hash = ParseHashV(request.params[1], "Object hash");
|
||||
std::string strVoteSignal = request.params[2].get_str();
|
||||
std::string strVoteOutcome = request.params[3].get_str();
|
||||
@ -629,12 +629,12 @@ UniValue gobject_vote_alias(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (request.fHelp || request.params.size() != 5)
|
||||
gobject_vote_alias_help(pwallet);
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || request.params.size() != 5)
|
||||
gobject_vote_alias_help(pwallet);
|
||||
|
||||
uint256 hash = ParseHashV(request.params[1], "Object hash");
|
||||
std::string strVoteSignal = request.params[2].get_str();
|
||||
std::string strVoteOutcome = request.params[3].get_str();
|
||||
|
@ -190,12 +190,12 @@ UniValue masternode_outputs(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (request.fHelp)
|
||||
masternode_outputs_help();
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp)
|
||||
masternode_outputs_help();
|
||||
|
||||
LOCK2(cs_main, pwallet->cs_wallet);
|
||||
|
||||
// Find possible candidates
|
||||
|
@ -405,6 +405,9 @@ UniValue protx_register(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
bool isExternalRegister = request.params[0].get_str() == "register";
|
||||
bool isFundRegister = request.params[0].get_str() == "register_fund";
|
||||
bool isPrepareRegister = request.params[0].get_str() == "register_prepare";
|
||||
@ -417,9 +420,6 @@ UniValue protx_register(const JSONRPCRequest& request)
|
||||
protx_register_prepare_help();
|
||||
}
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (isExternalRegister || isFundRegister) {
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
}
|
||||
@ -567,13 +567,13 @@ UniValue protx_register_submit(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || request.params.size() != 3) {
|
||||
protx_register_submit_help(pwallet);
|
||||
}
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CMutableTransaction tx;
|
||||
@ -622,12 +622,12 @@ UniValue protx_update_service(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (request.fHelp || (request.params.size() < 4 || request.params.size() > 6))
|
||||
protx_update_service_help(pwallet);
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || (request.params.size() < 4 || request.params.size() > 6))
|
||||
protx_update_service_help(pwallet);
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CProUpServTx ptx;
|
||||
@ -718,13 +718,13 @@ UniValue protx_update_registrar(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || (request.params.size() != 5 && request.params.size() != 6)) {
|
||||
protx_update_registrar_help(pwallet);
|
||||
}
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CProUpRegTx ptx;
|
||||
@ -807,13 +807,13 @@ UniValue protx_revoke(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || (request.params.size() < 3 || request.params.size() > 5)) {
|
||||
protx_revoke_help(pwallet);
|
||||
}
|
||||
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CProUpRevTx ptx;
|
||||
|
Loading…
Reference in New Issue
Block a user