}
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<CMalleableKeyView> &malleableViewList) const =0;
};
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
{
{
Solver(scriptPubKey, type, vSolutions);
out.push_back(Pair("keyVariant", HexStr(vSolutions[0])));
out.push_back(Pair("R", HexStr(vSolutions[1])));
- }
- Array a;
- BOOST_FOREACH(const CTxDestination& addr, addresses)
- a.push_back(CBitcoinAddress(addr).ToString());
- out.push_back(Pair("addresses", a));
+ CMalleableKeyView view;
+ if (pwalletMain->CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view))
+ out.push_back(Pair("keyView", view.ToString()));
+ }
+ else
+ {
+ Array a;
+ BOOST_FOREACH(const CTxDestination& addr, addresses)
+ a.push_back(CBitcoinAddress(addr).ToString());
+ out.push_back(Pair("addresses", a));
+ }
}
else
{