From 2c4ea4e4bc399dd38e539c1ae53d43274ad82458 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Tue, 27 May 2014 23:46:21 +0100 Subject: [PATCH] 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. --- rpcserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index ce7079f..ee4e133 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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,