aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcdump.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-04-12 17:56:44 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-04-12 19:37:29 +0200
commitb9fb692d04e90967b14c6988553c9121c5eea64e (patch)
tree0e7c4d478456af92478cc7df3ab07b0802f64ad4 /src/wallet/rpcdump.cpp
parent0b9dc9c8f5943a8389faa1fd0e52fa5ac6a4a759 (diff)
Push down RPC reqWallet flag
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r--src/wallet/rpcdump.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index b9c92a06c5..ab951d1d7d 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -25,6 +25,7 @@ using namespace json_spirit;
using namespace std;
void EnsureWalletIsUnlocked();
+bool EnsureWalletIsAvailable(bool avoidException);
std::string static EncodeDumpTime(int64_t nTime) {
return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime);
@@ -71,6 +72,9 @@ std::string DecodeDumpString(const std::string &str) {
Value importprivkey(const Array& params, bool fHelp)
{
+ if (!EnsureWalletIsAvailable(fHelp))
+ return Value::null;
+
if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error(
"importprivkey \"bitcoinprivkey\" ( \"label\" rescan )\n"
@@ -142,6 +146,9 @@ Value importprivkey(const Array& params, bool fHelp)
Value importaddress(const Array& params, bool fHelp)
{
+ if (!EnsureWalletIsAvailable(fHelp))
+ return Value::null;
+
if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error(
"importaddress \"address\" ( \"label\" rescan )\n"
@@ -212,6 +219,9 @@ Value importaddress(const Array& params, bool fHelp)
Value importwallet(const Array& params, bool fHelp)
{
+ if (!EnsureWalletIsAvailable(fHelp))
+ return Value::null;
+
if (fHelp || params.size() != 1)
throw runtime_error(
"importwallet \"filename\"\n"
@@ -313,6 +323,9 @@ Value importwallet(const Array& params, bool fHelp)
Value dumpprivkey(const Array& params, bool fHelp)
{
+ if (!EnsureWalletIsAvailable(fHelp))
+ return Value::null;
+
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey \"bitcoinaddress\"\n"
@@ -348,6 +361,9 @@ Value dumpprivkey(const Array& params, bool fHelp)
Value dumpwallet(const Array& params, bool fHelp)
{
+ if (!EnsureWalletIsAvailable(fHelp))
+ return Value::null;
+
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpwallet \"filename\"\n"