diff options
| author | Wladimir J. van der Laan <[email protected]> | 2011-06-26 19:23:24 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2011-06-26 19:23:24 +0200 |
| commit | e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98 (patch) | |
| tree | a6ff0ef6f8cdd85323acc1233a29891346b994fc /src/keystore.cpp | |
| parent | reduce spacing between "Add to address book as" and the text field (diff) | |
| download | discoin-e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98.tar.xz discoin-e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98.zip | |
update core to d0d80170a2ca73004e08fb85007fe055cbf4e411 (CWallet class)
Diffstat (limited to 'src/keystore.cpp')
| -rw-r--r-- | src/keystore.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp new file mode 100644 index 000000000..7dd045fe5 --- /dev/null +++ b/src/keystore.cpp @@ -0,0 +1,33 @@ +// Copyright (c) 2009-2011 Satoshi Nakamoto & Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. + +#include "headers.h" +#include "db.h" + + + +////////////////////////////////////////////////////////////////////////////// +// +// mapKeys +// + +std::vector<unsigned char> CKeyStore::GenerateNewKey() +{ + RandAddSeedPerfmon(); + CKey key; + key.MakeNewKey(); + if (!AddKey(key)) + throw std::runtime_error("GenerateNewKey() : AddKey failed"); + return key.GetPubKey(); +} + +bool CKeyStore::AddKey(const CKey& key) +{ + CRITICAL_BLOCK(cs_mapKeys) + { + mapKeys[key.GetPubKey()] = key.GetPrivKey(); + mapPubKeys[Hash160(key.GetPubKey())] = key.GetPubKey(); + } +} + |