]> Git Repo - VerusCoin.git/blobdiff - src/rpcrawtransaction.cpp
Merge pull request #2336 from petertodd/invalid-opcode-coverage
[VerusCoin.git] / src / rpcrawtransaction.cpp
index 09fbaa30cd54eb2aec12755078b028ec93088119..bbaf40c7352ebdfd3f4cd2408a1bb0ba399eb00c 100644 (file)
@@ -421,7 +421,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
 
             Object prevOut = p.get_obj();
 
-            RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
+            RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));
 
             uint256 txid = ParseHashO(prevOut, "txid");
 
@@ -450,12 +450,16 @@ Value signrawtransaction(const Array& params, bool fHelp)
 
             // if redeemScript given and not using the local wallet (private keys
             // given), add redeemScript to the tempKeystore so it can be signed:
-            Value v = find_value(prevOut, "redeemScript");
-            if (fGivenKeys && scriptPubKey.IsPayToScriptHash() && !(v == Value::null))
+            if (fGivenKeys && scriptPubKey.IsPayToScriptHash())
             {
-                vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
-                CScript redeemScript(rsData.begin(), rsData.end());
-                tempKeystore.AddCScript(redeemScript);
+                RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
+                Value v = find_value(prevOut, "redeemScript");
+                if (!(v == Value::null))
+                {
+                    vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
+                    CScript redeemScript(rsData.begin(), rsData.end());
+                    tempKeystore.AddCScript(redeemScript);
+                }
             }
         }
     }
@@ -546,8 +550,9 @@ Value sendrawtransaction(const Array& params, bool fHelp)
         fHave = view.GetCoins(hashTx, existingCoins);
         if (!fHave) {
             // push to local node
-            if (!tx.AcceptToMemoryPool())
-                throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected");
+            CValidationState state;
+            if (!tx.AcceptToMemoryPool(state, true, false))
+                throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
         }
     }
     if (fHave) {
This page took 0.042176 seconds and 4 git commands to generate.