X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Frpcdump.cpp;h=1bc87e921795f6b9b91de54a0c49d7abec44f15c;hb=ed6d0b5f852dc5f1c9407abecb5a9c6a7e42b4b2;hp=c7c5b1d36c684fa05620f031f0085c61823a00b9;hpb=21d9f36781604e4ca9fc35dc65265593423b73e9;p=novacoin.git diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index c7c5b1d..1bc87e9 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -1,22 +1,13 @@ -// Copyright (c) 2011 Bitcoin Developers +// Copyright (c) 2009-2012 Bitcoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. -#include - -#include "headers.h" #include "init.h" // for pwalletMain #include "bitcoinrpc.h" +#include "ui_interface.h" -// #include -// #include -// #include #include -// #ifdef USE_SSL -// #include -// typedef boost::asio::ssl::stream SSLStream; -// #endif -// #include + #include "json/json_spirit_reader_template.h" #include "json/json_spirit_writer_template.h" #include "json/json_spirit_utils.h" @@ -33,7 +24,7 @@ class CTxDump { public: CBlockIndex *pindex; - int64_t nValue; + int64 nValue; bool fSpent; CWalletTx* ptx; int nOut; @@ -64,12 +55,14 @@ Value importprivkey(const Array& params, bool fHelp) if (!fGood) throw JSONRPCError(-5,"Invalid private key"); CKey key; - key.SetSecret(vchSecret.GetSecret()); + bool fCompressed; + CSecret secret = vchSecret.GetSecret(fCompressed); + key.SetSecret(secret, fCompressed); CBitcoinAddress vchAddress = CBitcoinAddress(key.GetPubKey()); - CRITICAL_BLOCK(cs_main) - CRITICAL_BLOCK(pwalletMain->cs_wallet) { + LOCK2(cs_main, pwalletMain->cs_wallet); + pwalletMain->MarkDirty(); pwalletMain->SetAddressBookName(vchAddress, strLabel); @@ -97,7 +90,8 @@ Value dumpprivkey(const Array& params, bool fHelp) if (!address.SetString(strAddress)) throw JSONRPCError(-5, "Invalid bitcoin address"); CSecret vchSecret; - if (!pwalletMain->GetSecret(address, vchSecret)) + bool fCompressed; + if (!pwalletMain->GetSecret(address, vchSecret, fCompressed)) throw JSONRPCError(-4,"Private key for address " + strAddress + " is not known"); - return CBitcoinSecret(vchSecret).ToString(); + return CBitcoinSecret(vchSecret, fCompressed).ToString(); }