Skip to content

Commit

Permalink
Make compressed pubkeys require 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Feb 18, 2012
1 parent 9976cf0 commit 38067c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CKey
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");
Expand Down
9 changes: 8 additions & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 38067c1

Please sign in to comment.