diff --git a/src/NewcoinAddress.cpp b/src/NewcoinAddress.cpp index 7cf62467e..60de45be0 100644 --- a/src/NewcoinAddress.cpp +++ b/src/NewcoinAddress.cpp @@ -298,7 +298,7 @@ void NewcoinAddress::setAccountPublic(const std::vector& vPublic) void NewcoinAddress::setAccountPublic(const NewcoinAddress& generator, int seq) { - CKey pubkey = CKey(generator, seq+1); + CKey pubkey = CKey(generator, seq); setAccountPublic(pubkey.GetPubKey()); } @@ -371,7 +371,7 @@ void NewcoinAddress::setAccountPrivate(uint256 hash256) void NewcoinAddress::setAccountPrivate(const NewcoinAddress& generator, const NewcoinAddress& seed, int seq) { - CKey privkey = CKey(generator, seed.getFamilyPrivateKey(), seq+1); + CKey privkey = CKey(generator, seed.getFamilyPrivateKey(), seq); setAccountPrivate(privkey.GetPrivKey()); } @@ -646,9 +646,18 @@ bool NewcoinAddress::setFamilySeed(const std::string& strSeed) return SetString(strSeed.c_str(), VER_FAMILY_SEED); } -void NewcoinAddress::setFamilySeedGeneric(const std::string& strText) +bool NewcoinAddress::setFamilySeedGeneric(const std::string& strText) { - if (setFamilySeed(strText)) + NewcoinAddress naTemp; + bool bResult = true; + + if (naTemp.setAccountID(strText) + || naTemp.setAccountPublic(strText) + || naTemp.setAccountPrivate(strText)) + { + bResult = false; + } + else if (setFamilySeed(strText)) { // std::cerr << "Recognized seed." << std::endl; nothing(); @@ -663,6 +672,8 @@ void NewcoinAddress::setFamilySeedGeneric(const std::string& strText) // std::cerr << "Creating seed from pass phrase." << std::endl; setFamilySeed(CKey::PassPhraseToKey(strText)); } + + return bResult; } void NewcoinAddress::setFamilySeed(uint128 hash128) { diff --git a/src/NewcoinAddress.h b/src/NewcoinAddress.h index 6ea8fa1e2..a5eedb5f7 100644 --- a/src/NewcoinAddress.h +++ b/src/NewcoinAddress.h @@ -114,7 +114,7 @@ public: // // Family Seeds - // + // Clients must disallow reconizable entries from being seeds. uint128 getFamilySeed() const; BIGNUM* getFamilyPrivateKey() const; @@ -123,7 +123,7 @@ public: bool setFamilySeed(const std::string& strSeed); int setFamilySeed1751(const std::string& strHuman1751); - void setFamilySeedGeneric(const std::string& strText); + bool setFamilySeedGeneric(const std::string& strText); void setFamilySeed(uint128 hash128); void setFamilySeedRandom(); };