From f000947bc7a8f1db58920984124b027a11d47725 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Wed, 13 Jun 2012 17:50:44 -0700 Subject: [PATCH] Clean up creating seed from string. --- src/Application.cpp | 11 +++-------- src/NewcoinAddress.cpp | 9 +++++++++ src/NewcoinAddress.h | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 4057e86f77..019ea23a05 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -13,7 +13,7 @@ #include "key.h" #include "utils.h" #include "TaggedCache.h" -#include "boost/filesystem.hpp" +#include "boost/filesystem.hpp" Application* theApp = NULL; @@ -102,14 +102,9 @@ void Application::run() mConnectionPool.start(); // New stuff. - NewcoinAddress rootSeedMaster; - NewcoinAddress rootAddress; - - rootSeedMaster.setFamilySeed(CKey::PassPhraseToKey("masterpassphrase")); - + NewcoinAddress rootSeedMaster = NewcoinAddress::createSeedGeneric("masterpassphrase"); NewcoinAddress rootGeneratorMaster = NewcoinAddress::createGeneratorPublic(rootSeedMaster); - - rootAddress.setAccountPublic(rootGeneratorMaster, 0); + NewcoinAddress rootAddress = NewcoinAddress::createAccountPublic(rootGeneratorMaster, 0); // Print enough information to be able to claim root account. std::cerr << "Root master seed: " << rootSeedMaster.humanFamilySeed() << std::endl; diff --git a/src/NewcoinAddress.cpp b/src/NewcoinAddress.cpp index d80e9254f4..8fee0f8dd3 100644 --- a/src/NewcoinAddress.cpp +++ b/src/NewcoinAddress.cpp @@ -762,6 +762,15 @@ NewcoinAddress NewcoinAddress::createSeedRandom() return naNew; } +NewcoinAddress NewcoinAddress::createSeedGeneric(const std::string& strText) +{ + NewcoinAddress naNew; + + naNew.setFamilySeedGeneric(strText); + + return naNew; +} + BOOST_AUTO_TEST_SUITE(newcoin_address) BOOST_AUTO_TEST_CASE( my_test ) diff --git a/src/NewcoinAddress.h b/src/NewcoinAddress.h index be0938d939..c7c9490d99 100644 --- a/src/NewcoinAddress.h +++ b/src/NewcoinAddress.h @@ -171,6 +171,7 @@ public: void setFamilySeedRandom(); static NewcoinAddress createSeedRandom(); + static NewcoinAddress createSeedGeneric(const std::string& strText); }; #endif