Mercurial > hg > bitcoin
changeset 1874:8a4c3c15ef07 draft
Move GenerateNewKey back to CWallet
author | Pieter Wuille <pieter.wuille@gmail.com> |
---|---|
date | Sat, 18 Feb 2012 15:02:36 +0100 |
parents | b2f5529c60ca |
children | 83a2f73e637b |
files | src/keystore.cpp src/keystore.h src/wallet.cpp src/wallet.h |
diffstat | 4 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -8,16 +8,6 @@ #include "db.h" #include "script.h" -std::vector<unsigned char> CKeyStore::GenerateNewKey() -{ - RandAddSeedPerfmon(); - CKey key; - key.MakeNewKey(); - if (!AddKey(key)) - throw std::runtime_error("CKeyStore::GenerateNewKey() : AddKey failed"); - return key.GetPubKey(); -} - bool CKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char> &vchPubKeyOut) const { CKey key;
--- a/src/keystore.h +++ b/src/keystore.h @@ -29,8 +29,6 @@ virtual bool HaveCScript(const uint160 &hash) const =0; virtual bool GetCScript(const uint160 &hash, CScript& redeemScriptOut) const =0; - // Generate a new key, and add it to the store - virtual std::vector<unsigned char> GenerateNewKey(); virtual bool GetSecret(const CBitcoinAddress &address, CSecret& vchSecret, bool &fCompressed) const { CKey key;
--- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -15,6 +15,16 @@ // mapWallet // +std::vector<unsigned char> CWallet::GenerateNewKey() +{ + RandAddSeedPerfmon(); + CKey key; + key.MakeNewKey(); + if (!AddKey(key)) + throw std::runtime_error("CWallet::GenerateNewKey() : AddKey failed"); + return key.GetPubKey(); +} + bool CWallet::AddKey(const CKey& key) { if (!CCryptoKeyStore::AddKey(key))
--- a/src/wallet.h +++ b/src/wallet.h @@ -66,6 +66,8 @@ std::vector<unsigned char> vchDefaultKey; // keystore implementation + // Generate a new key + std::vector<unsigned char> GenerateNewKey(); // Adds a key to the store, and saves it to disk. bool AddKey(const CKey& key); // Adds a key to the store, without saving it to disk (used by LoadWallet)