aboutsummaryrefslogtreecommitdiff
path: root/src/rpcdump.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2011-11-21 02:46:28 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2012-01-09 15:18:19 +0100
commit11529c6e4f7288d8a64c488a726ee3821c7adefe (patch)
tree0f727a647b327687eb7894d824eb47d3578dfb92 /src/rpcdump.cpp
parent1684f98b27de9323d24ee4489af54dd84083956a (diff)
downloadbitcoin-11529c6e4f7288d8a64c488a726ee3821c7adefe.tar.xz
Compressed pubkeys
This patch enabled compressed pubkeys when -compressedpubkeys is passed. These are 33 bytes instead of 65, and require only marginally more CPU power when verifying. Compressed pubkeys have a different corresponding address, so it is determined at generation. When -compressedpubkeys is given, all newly generated addresses will use a compressed key, while older/other addresses keep using normal keys. Unpatched clients will relay and verify these transactions.
Diffstat (limited to 'src/rpcdump.cpp')
-rw-r--r--src/rpcdump.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp
index f3978fbce8..471421e75c 100644
--- a/src/rpcdump.cpp
+++ b/src/rpcdump.cpp
@@ -62,7 +62,9 @@ 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)
@@ -95,7 +97,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();
}