segwit signing bug fix

This commit is contained in:
OutCast3k 2018-06-19 15:45:21 +00:00
parent 9bede2aef4
commit fd81fafdff
2 changed files with 19 additions and 10 deletions

View file

@ -1549,11 +1549,20 @@
if(!witness_used.includes(y)){
var sw = coinjs.segwitAddress(this.witness[y][1]);
var b32 = coinjs.bech32Address(this.witness[y][1]);
if(this.ins[i].script.chunks.length>0){
if((sw['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0])) || (b32['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0]))){
var rs = '';
if(this.ins[i].script.chunks.length>=1){
rs = Crypto.util.bytesToHex(this.ins[i].script.chunks[0]);
} else if (this.ins[i].script.chunks.length==0){
rs = b32['redeemscript'];
}
if((sw['redeemscript'] == rs) || (b32['redeemscript'] == rs)){
witness_order.push(this.witness[y]);
witness_used.push(y);
if(b32['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0])){
// bech32, empty redeemscript
if(b32['redeemscript'] == rs){
this.ins[index].script = coinjs.script();
}
break;
@ -1561,7 +1570,7 @@
}
}
}
}
this.witness = witness_order;
}
}

View file

@ -1,9 +1,9 @@
---- Version 1.4 2018.06.17 ---
---- Version 1.4 2018.06.19 ---
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
988f99187ab356bc5d12b61572f463e1785c15c2 ./js/coinbin.js
776a3e2ae1e5835cf0c290987ac5343d8f57ad73 ./js/coin.js
8b4163122d907f9c363b9afd8809490f5ba202c8 ./js/coin.js
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js