Skip to content

Commit 677915b

Browse files
author
Arik Sosman
committed
re-add script buffer
Reviewers: alex Reviewed By: alex Subscribers: ben Differential Revision: https://phabricator.bitgo.com/D6113
1 parent 31131f8 commit 677915b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/v2/coins/bch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Bch.prototype.signTransaction = function(params) {
3636
throw new Error('length of unspents array should equal to the number of transaction inputs');
3737
}
3838

39+
const sigHashType = bitcoin.Transaction.SIGHASH_ALL | bitcoin.Transaction.SIGHASH_BITCOINCASHBIP143;
3940
var keychain = bitcoin.HDNode.fromBase58(userPrv);
4041
var hdPath = bitcoin.hdPath(keychain);
4142

@@ -48,9 +49,9 @@ Bch.prototype.signTransaction = function(params) {
4849
txb.enableBitcoinCash(true);
4950
// TODO (arik): Figure out if version 2 is actually necessary
5051
txb.setVersion(2);
51-
const sigHashType = bitcoin.Transaction.SIGHASH_ALL | bitcoin.Transaction.SIGHASH_BITCOINCASHBIP143;
52+
var subscript = new Buffer(txPrebuild.txInfo.unspents[index].redeemScript, 'hex');
5253
try {
53-
txb.sign(index, privKey, null, sigHashType, value);
54+
txb.sign(index, privKey, subscript, sigHashType, value);
5455
} catch (e) {
5556
throw new Error('Failed to sign input #' + index);
5657
}

0 commit comments

Comments
 (0)