X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fkey.h;fp=src%2Fkey.h;h=67c414e516f3ac3724c4aeecb801e90ae5f74daf;hp=38ebe764c993fdd38565bf407a760d49614b36be;hb=7f910f05a59a13fc96b8a4cafa4e6fdd5de725e4;hpb=8df93a092b9d9610e52c8405fe0b43374e9fba6f diff --git a/src/key.h b/src/key.h index 38ebe76..67c414e 100644 --- a/src/key.h +++ b/src/key.h @@ -226,7 +226,6 @@ public: } CMalleablePubKey(const std::string& strMalleablePubKey) { SetString(strMalleablePubKey); } CMalleablePubKey(const CPubKey &pubKeyInL, const CPubKey &pubKeyInH) : pubKeyL(pubKeyInL), pubKeyH(pubKeyInH) { nVersion = CMalleablePubKey::CURRENT_VERSION; } - CMalleablePubKey(const std::vector &pubKeyInL, const std::vector &pubKeyInH) : pubKeyL(pubKeyInL), pubKeyH(pubKeyInH) { nVersion = CMalleablePubKey::CURRENT_VERSION; } IMPLEMENT_SERIALIZE( READWRITE(this->nVersion); @@ -299,8 +298,11 @@ public: void Reset(); void MakeNewKeys(); bool IsNull() const; + bool IsValid() const { return !IsNull() && GetMalleablePubKey().IsValid(); } bool SetSecrets(const CSecret &pvchSecretL, const CSecret &pvchSecretH); - void GetSecrets(CSecret &pvchSecretL, CSecret &pvchSecretH) const; + + CSecret GetSecretL() const { return vchSecretL; } + CSecret GetSecretH() const { return vchSecretH; } CKeyID GetID() const { return GetMalleablePubKey().GetID(); @@ -322,13 +324,11 @@ private: public: CMalleableKeyView() { nVersion = 0; }; CMalleableKeyView(const CMalleableKey &b); - CMalleableKeyView(const CSecret &L, const CPubKey &pvchPubKeyH); CMalleableKeyView(const CMalleableKeyView &b); CMalleableKeyView& operator=(const CMalleableKey &b); ~CMalleableKeyView(); - IMPLEMENT_SERIALIZE( READWRITE(this->nVersion); nVersion = this->nVersion; @@ -337,6 +337,7 @@ public: ) bool IsNull() const; + bool IsValid() const { return !IsNull() && GetMalleablePubKey().IsValid(); } std::string ToString() const; bool SetString(const std::string& strMalleablePubKey); std::vector Raw() const; @@ -351,6 +352,7 @@ public: return GetMalleablePubKey().GetID(); } CMalleablePubKey GetMalleablePubKey() const; + CMalleableKey GetMalleableKey(const CSecret &vchSecretH) const { return CMalleableKey(vchSecretL, vchSecretH); } bool CheckKeyVariant(const CPubKey &R, const CPubKey &vchPubKeyVariant) const; bool operator <(const CMalleableKeyView& kv) const { return vchPubKeyH.GetID() < kv.vchPubKeyH.GetID(); }