X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fkeystore.h;h=fa4f33c9048e5f95b52f5fb32e48e45c01ad6144;hb=9c9ba366ebc85b0d8eef6d962a9fa84cffe0cae7;hp=f03ffb3794ba5446cfc7731861e591cda52f9d01;hpb=31442f0370ff570f249d60cc8b99752b1ddb0715;p=novacoin.git diff --git a/src/keystore.h b/src/keystore.h index f03ffb3..fa4f33c 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -70,6 +70,7 @@ public: } virtual bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const =0; + virtual bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const =0; virtual bool CreatePrivKey(const CPubKey &pubKeyVariant, const CPubKey &R, CKey &privKey) const =0; virtual void ListMalleableViews(std::list &malleableViewList) const =0; }; @@ -160,6 +161,22 @@ public: return false; } + bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const + { + { + LOCK(cs_KeyStore); + for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++) + { + if (mi->first.CheckKeyVariant(R, pubKeyVariant)) + { + view = mi->first; + return true; + } + } + } + return false; + } + bool CreatePrivKey(const CPubKey &pubKeyVariant, const CPubKey &R, CKey &privKey) const { { @@ -183,6 +200,22 @@ public: malleableViewList.push_back(CMalleableKeyView(mi->first)); } } + + bool GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view) + { + const CKeyID &mpkID = mpk.GetID(); + { + LOCK(cs_KeyStore); + for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++) + if (mi->first.GetID() == mpkID) + { + view = CMalleableKeyView(mi->first); + return true; + } + } + + return false; + } }; typedef std::map > > CryptedKeyMap;