aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/key.h2
-rw-r--r--src/wallet.cpp9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/key.h b/src/key.h
index 9e92897e26..43c8d84520 100644
--- a/src/key.h
+++ b/src/key.h
@@ -114,7 +114,7 @@ public:
return fCompressedPubKey;
}
- void MakeNewKey(bool fCompressed = true)
+ void MakeNewKey(bool fCompressed)
{
if (!EC_KEY_generate_key(pkey))
throw key_error("CKey::MakeNewKey() : EC_KEY_generate_key failed");
diff --git a/src/wallet.cpp b/src/wallet.cpp
index da64aa5103..8a33041a1c 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -17,9 +17,16 @@ using namespace std;
std::vector<unsigned char> CWallet::GenerateNewKey()
{
+ bool fCompressed = true; // default to compressed public keys
+
RandAddSeedPerfmon();
CKey key;
- key.MakeNewKey();
+ key.MakeNewKey(fCompressed);
+
+ // Compressed public keys were introduced in version 0.6.0
+ if (fCompressed)
+ SetMinVersion(59900);
+
if (!AddKey(key))
throw std::runtime_error("CWallet::GenerateNewKey() : AddKey failed");
return key.GetPubKey();