From 6c22adaa5a8f908f95791c6b7936c8f3f9dcf39b Mon Sep 17 00:00:00 2001 From: OutCast3k Date: Fri, 10 Feb 2017 13:05:58 +0000 Subject: [PATCH] added extra sighash support for signing --- js/coin.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/coin.js b/js/coin.js index ab5aeb7..9f08faf 100644 --- a/js/coin.js +++ b/js/coin.js @@ -1216,7 +1216,8 @@ } /* sign inputs */ - r.sign = function(wif){ + r.sign = function(wif, sigHashType){ + var shType = sigHashType || 1; for (var i = 0; i < this.ins.length; i++) { var d = this.extractScriptKey(i); @@ -1225,11 +1226,11 @@ var pubkeyHash = script.pubkeyHash(w2a['address']); if(((d['type'] == 'scriptpubkey' && d['script']==Crypto.util.bytesToHex(pubkeyHash.buffer)) || d['type'] == 'empty') && d['signed'] == "false"){ - this.signinput(i, wif); + this.signinput(i, wif, shType); } else if (d['type'] == 'hodl' && d['signed'] == "false") { - this.signhodl(i, wif); + this.signhodl(i, wif, shType); } else if (d['type'] == 'multisig') { - this.signmultisig(i, wif); + this.signmultisig(i, wif, shType); } else { // could not sign }