From eb3513a23fc86655b0904e7a0ff1a91e6911c0a8 Mon Sep 17 00:00:00 2001 From: tripathyr Date: Wed, 28 Sep 2022 18:08:21 +0530 Subject: [PATCH] Bux fix in Bitcoin signature Signature updated to take into account sighash_type --- lib_btc.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_btc.js b/lib_btc.js index ef728ab..55ad371 100644 --- a/lib_btc.js +++ b/lib_btc.js @@ -2653,11 +2653,11 @@ return coinjs.verifySignature(h1, s1, p2); } - coinjs.generateBitcoinSignature = function (private_key,hash){ + coinjs.generateBitcoinSignature = function (private_key,hash,sighash_type_int = 1){ var wif, tx1; - if (private_key.length < 60) { wif = private_key } else { wif = coinjs.privkey2wif(private_key);} + if (private_key.length < 60) { wif = private_key } else { wif = coinjs.privkey2wif(private_key) }; tx1 = coinjs.transaction(); - return tx1.transactionSigNoIndex(wif,1,hash); + return tx1.transactionSigNoIndex(wif,sighash_type_int,hash); } coinjs.dSHA256 = function(data){