NewcoinAddress fixes and work towards unls.

This commit is contained in:
Arthur Britto
2012-03-20 15:20:39 -07:00
parent 6bf311c819
commit d0eb4567ba
12 changed files with 295 additions and 142 deletions

View File

@@ -2,7 +2,8 @@
#include "key.h"
#include "Config.h"
#include "BitcoinUtil.h"
#include "openssl/ec.h"
#include "openssl/rand.h"
#include <cassert>
#include <algorithm>
@@ -73,6 +74,10 @@ void NewcoinAddress::setHanko(const uint160& hash160)
SetData(VER_HANKO, hash160.begin(), 20);
}
void NewcoinAddress::setHanko(const NewcoinAddress& nodePublic) {
setHanko(nodePublic.getHanko());
}
//
// NodePublic
//
@@ -158,6 +163,10 @@ bool NewcoinAddress::setNodePrivate(const std::string& strPrivate)
return SetString(strPrivate.c_str(), VER_NODE_PRIVATE);
}
void NewcoinAddress::setNodePrivate(const std::vector<unsigned char>& vPrivate) {
SetData(VER_NODE_PRIVATE, vPrivate);
}
void NewcoinAddress::setNodePrivate(uint256 hash256)
{
SetData(VER_NODE_PRIVATE, hash256.begin(), 32);
@@ -311,6 +320,11 @@ bool NewcoinAddress::setAccountPrivate(const std::string& strPrivate)
return SetString(strPrivate.c_str(), VER_ACCOUNT_PRIVATE);
}
void NewcoinAddress::setAccountPrivate(const std::vector<unsigned char>& vPrivate)
{
SetData(VER_ACCOUNT_PRIVATE, vPrivate);
}
void NewcoinAddress::setAccountPrivate(uint256 hash256)
{
SetData(VER_ACCOUNT_PRIVATE, hash256.begin(), 32);
@@ -446,4 +460,13 @@ bool NewcoinAddress::setFamilySeed(const std::string& strSeed)
void NewcoinAddress::setFamilySeed(uint128 hash128) {
SetData(VER_FAMILY_SEED, hash128.begin(), 16);
}
void NewcoinAddress::setFamilySeedRandom()
{
uint128 key;
RAND_bytes((unsigned char *) &key, sizeof(key));
NewcoinAddress::setFamilySeed(key);
}
// vim:ts=4