hashtype is not flag based despite having a flag embedded.

So (SigHashAll & SigHashSingle)!= 0, which is not the intention here. fix up
that check to only match SigHashSingle.

Found by drahn, debugged together, fix by me.
This commit is contained in:
Owain G. Ainsworth 2014-05-27 23:46:21 +01:00
parent c53ada2f71
commit 2c4ea4e4bc

View file

@ -2014,8 +2014,8 @@ func SignRawTransaction(icmd btcjson.Cmd) (interface{}, *btcjson.Error) {
// SigHashSingle inputs can only be signed if there's a
// corresponding output. However this could be already signed,
// so we always verify the output.
if (hashType&btcscript.SigHashSingle) == 0 ||
i < len(msgTx.TxOut) {
if (hashType&btcscript.SigHashSingle) !=
btcscript.SigHashSingle || i < len(msgTx.TxOut) {
script, err := btcscript.SignTxOutput(activeNet.Net,
msgTx, i, input, byte(hashType), getKey,