Browse Source

Merge pull request #2264 from gmaxwell/signrawtransaction_for_regular_missing_txins

Signrawtransaction shouldn't require redeemScript for non-p2sh txins.
0.8
Gavin Andresen 12 years ago
parent
commit
817c44a00d
  1. 16
      src/rpcrawtransaction.cpp

16
src/rpcrawtransaction.cpp

@ -421,7 +421,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
Object prevOut = p.get_obj(); 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"); 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 // if redeemScript given and not using the local wallet (private keys
// given), add redeemScript to the tempKeystore so it can be signed: // given), add redeemScript to the tempKeystore so it can be signed:
Value v = find_value(prevOut, "redeemScript"); if (fGivenKeys && scriptPubKey.IsPayToScriptHash())
if (fGivenKeys && scriptPubKey.IsPayToScriptHash() && !(v == Value::null))
{ {
vector<unsigned char> rsData(ParseHexV(v, "redeemScript")); RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
CScript redeemScript(rsData.begin(), rsData.end()); Value v = find_value(prevOut, "redeemScript");
tempKeystore.AddCScript(redeemScript); if (!(v == Value::null))
{
vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end());
tempKeystore.AddCScript(redeemScript);
}
} }
} }
} }

Loading…
Cancel
Save