mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
update core to d0d80170a2 (CWallet class)
This commit is contained in:
parent
d99f5a470c
commit
e8ef3da713
34 changed files with 2496 additions and 2218 deletions
33
src/keystore.cpp
Normal file
33
src/keystore.cpp
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue