Use CBitcoinAddress ti store change destination
[novacoin.git] / src / rpcdump.cpp
index b0693ed..6e72688 100644 (file)
@@ -39,6 +39,8 @@ Value importprivkey(const Array& params, bool fHelp)
             "importprivkey <novacoinprivkey> [label] [rescan=true]\n"
             "Adds a private key (as returned by dumpprivkey) to your wallet.");
 
+    EnsureWalletIsUnlocked();
+
     string strSecret = params[0].get_str();
     string strLabel = "";
     if (params.size() > 1)
@@ -247,6 +249,8 @@ Value dumpmalleablekey(const Array& params, bool fHelp)
             "dumpmalleablekey <Key view>\n"
             "Dump the private and public key pairs, which correspond to provided key view.\n");
 
+    EnsureWalletIsUnlocked();
+
     CMalleableKey mKey;
     CMalleableKeyView keyView;
     keyView.SetString(params[0].get_str());
@@ -256,7 +260,7 @@ Value dumpmalleablekey(const Array& params, bool fHelp)
 
     Object result;
     result.push_back(Pair("PrivatePair", mKey.ToString()));
-    result.push_back(Pair("PublicPair", mKey.GetMalleablePubKey().ToString()));
+    result.push_back(Pair("Address", CBitcoinAddress(mKey.GetMalleablePubKey()).ToString()));
 
     return result;
 }
@@ -268,6 +272,9 @@ Value importmalleablekey(const Array& params, bool fHelp)
             "importmalleablekey <Key data>\n"
             "Imports the private key pair into your wallet.\n");
 
+
+    EnsureWalletIsUnlocked();
+
     CMalleableKey mKey;
     bool fSuccess = mKey.SetString(params[0].get_str());
 
@@ -277,7 +284,7 @@ Value importmalleablekey(const Array& params, bool fHelp)
     {
         fSuccess = pwalletMain->AddMalleableKey(mKey);
         result.push_back(Pair("Successful", fSuccess));
-        result.push_back(Pair("PublicPair", mKey.GetMalleablePubKey().ToString()));
+        result.push_back(Pair("Address", CBitcoinAddress(mKey.GetMalleablePubKey()).ToString()));
         result.push_back(Pair("KeyView", CMalleableKeyView(mKey).ToString()));
     }
     else