danicoin/src/CryptoNoteCore/Account.cpp

38 lines
1.2 KiB
C++
Raw Normal View History

// Copyright (c) 2011-2016 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-03-03 22:07:58 +00:00
2015-07-30 15:22:07 +00:00
#include "Account.h"
#include "CryptoNoteSerialization.h"
2014-08-13 10:51:37 +00:00
2015-07-15 12:23:00 +00:00
namespace CryptoNote {
//-----------------------------------------------------------------
2015-07-30 15:22:07 +00:00
AccountBase::AccountBase() {
setNull();
2015-07-15 12:23:00 +00:00
}
//-----------------------------------------------------------------
2015-07-30 15:22:07 +00:00
void AccountBase::setNull() {
m_keys = AccountKeys();
2015-07-15 12:23:00 +00:00
}
//-----------------------------------------------------------------
2015-07-30 15:22:07 +00:00
void AccountBase::generate() {
Crypto::generate_keys(m_keys.address.spendPublicKey, m_keys.spendSecretKey);
Crypto::generate_keys(m_keys.address.viewPublicKey, m_keys.viewSecretKey);
2015-07-15 12:23:00 +00:00
m_creation_timestamp = time(NULL);
}
//-----------------------------------------------------------------
2015-07-30 15:22:07 +00:00
const AccountKeys &AccountBase::getAccountKeys() const {
2015-07-15 12:23:00 +00:00
return m_keys;
}
2015-07-30 15:22:07 +00:00
void AccountBase::setAccountKeys(const AccountKeys &keys) {
2015-07-15 12:23:00 +00:00
m_keys = keys;
}
//-----------------------------------------------------------------
2015-07-30 15:22:07 +00:00
void AccountBase::serialize(ISerializer &s) {
2015-07-15 12:23:00 +00:00
s(m_keys, "m_keys");
s(m_creation_timestamp, "m_creation_timestamp");
}
2014-03-03 22:07:58 +00:00
}