From 9976cf070fdda61afa30cd65ef5bcddad4f43e81 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 18 Feb 2012 15:02:36 +0100 Subject: [PATCH] Move GenerateNewKey back to CWallet --- src/keystore.cpp | 10 ---------- src/keystore.h | 2 -- src/wallet.cpp | 10 ++++++++++ src/wallet.h | 2 ++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/keystore.cpp b/src/keystore.cpp index 18e5c377d..e76f7790f 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -8,16 +8,6 @@ #include "db.h" #include "script.h" -std::vector 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 &vchPubKeyOut) const { CKey key; diff --git a/src/keystore.h b/src/keystore.h index 7eea02def..6757834bd 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -29,8 +29,6 @@ public: 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 GenerateNewKey(); virtual bool GetSecret(const CBitcoinAddress &address, CSecret& vchSecret, bool &fCompressed) const { CKey key; diff --git a/src/wallet.cpp b/src/wallet.cpp index 42c49aa89..da64aa510 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -15,6 +15,16 @@ using namespace std; // mapWallet // +std::vector 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)) diff --git a/src/wallet.h b/src/wallet.h index 622ff974b..fea329778 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -66,6 +66,8 @@ public: std::vector vchDefaultKey; // keystore implementation + // Generate a new key + std::vector 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)