Raw transactions: TX_PUBKEY_DROP parsing
authorCryptoManiac <balthazar@yandex.ru>
Fri, 19 Feb 2016 17:04:45 +0000 (20:04 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Fri, 19 Feb 2016 17:04:45 +0000 (20:04 +0300)
src/rpcrawtransaction.cpp
src/script.cpp

index fd40d5f..4bcf911 100644 (file)
@@ -40,6 +40,16 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeH
         out.push_back(Pair("reqSigs", nRequired));
         out.push_back(Pair("type", GetTxnOutputType(type)));
 
+        if (type == TX_PUBKEY_DROP)
+        {
+            vector<valtype> vSolutions;
+            if (!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());
index b79dc23..e8bfab5 100644 (file)
@@ -1507,14 +1507,9 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
     case TX_PUBKEY_DROP:
         {
             CPubKey key = CPubKey(vSolutions[0]);
-            if (keystore.HaveKey(key.GetID()))
+            CPubKey R = CPubKey(vSolutions[1]);
+            if (keystore.CheckOwnership(key, R))
                 return MINE_SPENDABLE;
-            else
-            {
-                CPubKey R = CPubKey(vSolutions[1]);
-                if (keystore.CheckOwnership(key, R))
-                    return MINE_SPENDABLE;
-            }
         }
         break;
     case TX_PUBKEYHASH:
@@ -1559,7 +1554,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
     if (!Solver(scriptPubKey, whichType, vSolutions))
         return false;
 
-    if (whichType == TX_PUBKEY || whichType == TX_PUBKEY_DROP)
+    if (whichType == TX_PUBKEY)
     {
         addressRet = CPubKey(vSolutions[0]).GetID();
         return true;
@@ -1623,7 +1618,7 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
     vector<valtype> vSolutions;
     if (!Solver(scriptPubKey, typeRet, vSolutions))
         return false;
-    if (typeRet == TX_NULL_DATA)
+    if (typeRet == TX_NULL_DATA || typeRet == TX_PUBKEY_DROP)
         return true;
 
     if (typeRet == TX_MULTISIG)