aboutsummaryrefslogtreecommitdiff
path: root/src/rpcdump.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-05-01 06:52:05 +0200
committerPieter Wuille <sipa@ulyssis.org>2013-05-30 05:20:21 +0200
commitdfa23b94c24aae6466152fccbe896ba5dc0e97b4 (patch)
treea1f7f856577b2223bae9351c960b595b4032ce7a /src/rpcdump.cpp
parent5d891489ab7828ad8db15e85bb63e2f13f021a6a (diff)
downloadbitcoin-dfa23b94c24aae6466152fccbe896ba5dc0e97b4.tar.xz
CSecret/CKey -> CKey/CPubKey split/refactor
Diffstat (limited to 'src/rpcdump.cpp')
-rw-r--r--src/rpcdump.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp
index 77cef02736..d46309eaa4 100644
--- a/src/rpcdump.cpp
+++ b/src/rpcdump.cpp
@@ -54,20 +54,18 @@ Value importprivkey(const Array& params, bool fHelp)
if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
- CKey key;
- bool fCompressed;
- CSecret secret = vchSecret.GetSecret(fCompressed);
- key.SetSecret(secret, fCompressed);
- CKeyID vchAddress = key.GetPubKey().GetID();
+ CKey key = vchSecret.GetKey();
+ CPubKey pubkey = key.GetPubKey();
+ CKeyID vchAddress = pubkey.GetID();
{
LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->MarkDirty();
pwalletMain->SetAddressBookName(vchAddress, strLabel);
- if (!pwalletMain->AddKey(key))
+ if (!pwalletMain->AddKeyPubKey(key, pubkey))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet");
-
+
if (fRescan) {
pwalletMain->ScanForWalletTransactions(pindexGenesisBlock, true);
pwalletMain->ReacceptWalletTransactions();
@@ -91,9 +89,8 @@ Value dumpprivkey(const Array& params, bool fHelp)
CKeyID keyID;
if (!address.GetKeyID(keyID))
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");
- CSecret vchSecret;
- bool fCompressed;
- if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed))
+ CKey vchSecret;
+ if (!pwalletMain->GetKey(keyID, vchSecret))
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
- return CBitcoinSecret(vchSecret, fCompressed).ToString();
+ return CBitcoinSecret(vchSecret).ToString();
}