diff options
author | Gregory Maxwell <greg@xiph.org> | 2013-02-01 22:59:42 -0500 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2013-02-01 22:59:42 -0500 |
commit | 21c6d3aead31ba80af060749ba55c1aee9bf2cca (patch) | |
tree | 844387d81fb44c5198a36cbb6e347a4eb4efb97e /src/rpcrawtransaction.cpp | |
parent | 3d29d5d623c03a26177176a9b422cb00dedd9108 (diff) |
Signrawtransaction shouldn't require redeemScript for non-p2sh txins.
The redeemScript functionality broke plain offline signing, this
change makes it only look for that parameter when signing a p2sh
input.
Diffstat (limited to 'src/rpcrawtransaction.cpp')
-rw-r--r-- | src/rpcrawtransaction.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 5224051ace..bbaf40c735 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -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); + } } } } |