Skip to content

Commit

Permalink
Merge pull request #2264 from gmaxwell/signrawtransaction_for_regular…
Browse files Browse the repository at this point in the history
…_missing_txins

Signrawtransaction shouldn't require redeemScript for non-p2sh txins.
  • Loading branch information
gavinandresen committed Feb 6, 2013
2 parents 43ba1a1 + 21c6d3a commit 817c44a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/rpcrawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 817c44a

Please sign in to comment.