bug fix for issue #118 (do not generate a multisig address when the redeemscript is too large >520bytes)

This commit is contained in:
OutCast3k 2017-10-04 08:35:51 +00:00
parent b1603821da
commit 217897285e
3 changed files with 19 additions and 9 deletions

View file

@ -132,7 +132,13 @@
var checksum = r.slice(0,4);
var redeemScript = Crypto.util.bytesToHex(s.buffer);
var address = coinjs.base58encode(x.concat(checksum));
return {'address':address, 'redeemScript':redeemScript};
if(s.buffer.length > 520){ // too large
address = 'invalid';
redeemScript = 'invalid';
}
return {'address':address, 'redeemScript':redeemScript, 'size': s.buffer.length};
}
/* new time locked address, provide the pubkey and time necessary to unlock the funds.

View file

@ -379,11 +379,15 @@ $(document).ready(function() {
if(($("#multisigPubKeys .pubkey").parent().hasClass('has-error')==false) && $("#releaseCoins").parent().hasClass('has-error')==false){
var sigsNeeded = $("#releaseCoins option:selected").html();
var multisig = coinjs.pubkeys2MultisigAddress(keys, sigsNeeded);
$("#multiSigData .address").val(multisig['address']);
$("#multiSigData .script").val(multisig['redeemScript']);
$("#multiSigData .scriptUrl").val(document.location.origin+''+document.location.pathname+'?verify='+multisig['redeemScript']+'#verify');
$("#multiSigData").removeClass('hidden').addClass('show').fadeIn();
$("#releaseCoins").removeClass('has-error');
if(multisig.size <= 520){
$("#multiSigData .address").val(multisig['address']);
$("#multiSigData .script").val(multisig['redeemScript']);
$("#multiSigData .scriptUrl").val(document.location.origin+''+document.location.pathname+'?verify='+multisig['redeemScript']+'#verify');
$("#multiSigData").removeClass('hidden').addClass('show').fadeIn();
$("#releaseCoins").removeClass('has-error');
} else {
$("#multiSigErrorMsg").html('<span class="glyphicon glyphicon-exclamation-sign"></span> Your generated redeemscript is too large (>520 bytes) it can not be used safely').fadeIn();
}
} else {
$("#multiSigErrorMsg").html('<span class="glyphicon glyphicon-exclamation-sign"></span> One or more public key is invalid!').fadeIn();
}

View file

@ -1,9 +1,9 @@
---- Version 1.3 2017.10.01 ----
---- Version 1.3 2017.10.04 ----
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
e25332acfd75cb76139a5f9ebe268fa7374e8989 ./js/coinbin.js
494cefb8d6e59415ad25587de87a3dd1c055855e ./js/coin.js
8e9b7114276b56d1073698f025f707523d53631b ./js/coinbin.js
31fbebf65d9cae8f26761cb057c4fb1b97339d08 ./js/coin.js
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js