Round out node private key functionality.

This commit is contained in:
Arthur Britto
2012-04-29 12:59:39 -07:00
parent 79470a297c
commit 62ed100198
3 changed files with 16 additions and 0 deletions

View File

@@ -141,6 +141,20 @@ void NewcoinAddress::setNodePublic(const std::vector<unsigned char>& vPublic)
// NodePrivate // NodePrivate
// //
const std::vector<unsigned char>& NewcoinAddress::getNodePrivateData() const
{
switch (nVersion) {
case VER_NONE:
throw std::runtime_error("unset source");
case VER_NODE_PRIVATE:
return vchData;
default:
throw std::runtime_error(str(boost::format("bad source: %d") % int(nVersion)));
}
}
uint256 NewcoinAddress::getNodePrivate() const uint256 NewcoinAddress::getNodePrivate() const
{ {
switch (nVersion) { switch (nVersion) {

View File

@@ -54,6 +54,7 @@ public:
// //
// Node Private // Node Private
// //
const std::vector<unsigned char>& getNodePrivateData() const;
uint256 getNodePrivate() const; uint256 getNodePrivate() const;
std::string humanNodePrivate() const; std::string humanNodePrivate() const;

View File

@@ -51,6 +51,7 @@ public:
void start(); void start();
NewcoinAddress& getNodePublic() { return mNodePublicKey; } NewcoinAddress& getNodePublic() { return mNodePublicKey; }
NewcoinAddress& getNodePrivate() { return mNodePrivateKey; }
NewcoinAddress addFamily(const std::string& passPhrase, bool lock); NewcoinAddress addFamily(const std::string& passPhrase, bool lock);
NewcoinAddress addFamily(const NewcoinAddress& familySeed, bool lock); NewcoinAddress addFamily(const NewcoinAddress& familySeed, bool lock);