diff options
| author | Gregory Maxwell <[email protected]> | 2012-08-20 12:59:50 -0700 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2012-08-20 12:59:50 -0700 |
| commit | b86da2abe8695640698d45b1288a2951b7b3dfcb (patch) | |
| tree | eee82f3361318fdba92c62e8cfa19ea8ac4644f9 /src | |
| parent | Merge pull request #1526 from gavinandresen/heightincoinbase (diff) | |
| parent | When using SIGHASH_SINGLE, do not sign inputs that have no corresponding outp... (diff) | |
| download | discoin-b86da2abe8695640698d45b1288a2951b7b3dfcb.tar.xz discoin-b86da2abe8695640698d45b1288a2951b7b3dfcb.zip | |
Merge pull request #1689 from gavinandresen/rawtx_singlefix
When using SIGHASH_SINGLE, only sign inputs that have corresponding outputs
Diffstat (limited to 'src')
| -rw-r--r-- | src/rpcrawtransaction.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 57cba15ec..56a49fd4d 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -428,6 +428,8 @@ Value signrawtransaction(const Array& params, bool fHelp) throw JSONRPCError(-8, "Invalid sighash param"); } + bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE); + // Sign what we can: for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { @@ -440,7 +442,9 @@ Value signrawtransaction(const Array& params, bool fHelp) const CScript& prevPubKey = mapPrevOut[txin.prevout]; txin.scriptSig.clear(); - SignSignature(keystore, prevPubKey, mergedTx, i, nHashType); + // Only sign SIGHASH_SINGLE if there's a corresponding output: + if (!fHashSingle || (i < mergedTx.vout.size())) + SignSignature(keystore, prevPubKey, mergedTx, i, nHashType); // ... and merge in other signatures: BOOST_FOREACH(const CTransaction& txv, txVariants) |