finish m_n script

This commit is contained in:
Manuel Araoz 2014-05-21 16:10:39 -03:00
parent 73e7d2a827
commit 89cdfb3f7c
No known key found for this signature in database
GPG Key ID: 64F3727BFE0B3196
3 changed files with 20 additions and 20 deletions

View File

@ -96,7 +96,7 @@ angular.module('copay.send').controller('SendController',
//alert(JSON.stringify(qrcode.process(context)));
qrcode.decode();
} catch (e) {
alert(e);
console.log('error decoding QR: '+e);
}
}, 1500);
};

View File

@ -3,6 +3,7 @@
var imports = require('soop').imports();
var bitcore = require('bitcore');
var bignum = bitcore.Bignum;
var coinUtil = bitcore.util;
var buffertools = bitcore.buffertools;
var Builder = bitcore.TransactionBuilder;
@ -571,7 +572,7 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
var priv = this.privateKey;
opts = opts || {};
var amountSat = bitcore.bignum(amountSatStr);
var amountSat = bignum(amountSatStr);
if (!pkr.isComplete()) {
throw new Error('publicKeyRing is not complete');

View File

@ -19,10 +19,11 @@ var WalletFactory = require('soop').load('../js/models/core/WalletFactory', {
var Key = bitcore.Key;
var N_LIMIT = 16;
var N_LIMIT = 20;
var nn = 'livenet';
for (var n = 1; n < N_LIMIT; n++) {
for (var n = 1; n <= N_LIMIT; n++) {
var end = false;
for (var m = 1; m <= n; m++) {
// case m-of-n
console.log('case ' + m + '-of-' + n);
@ -64,28 +65,26 @@ for (var n = 1; n < N_LIMIT; n++) {
// create fake utxo
var utxos = [{
'address': addr,
'txid': '659e4e6d9c840e57aee6ebe35f2511cdeb848d786938f0b6b4f1b00de09b29da',
'txid': '82a974b72d3135152043989652e687e2966c651ba4822274926221017ea072d2',
'vout': 1,
'ts': 1400682132,
'scriptPubKey': 'a914e4a6744eeed5571cff9e427cbb5dd5e1a2d1b2fa87',
'amount': 10.000,
'confirmations': 100
'ts': 1400696213,
'scriptPubKey': 'a914b2562c950498ff48ad3479ca1c2dfda2b0273e2287',
'amount': 10.0,
'confirmations': 2
}];
var ntxid = w.createTxSync(toAddress, amount, utxos);
console.log('\t ntxid =' + ntxid);
var sign = function(pk, cb) {
w.sign(ntxid, cb);
}
async.each(pks, sign, function(err) {
if (err) {
throw new Error(err);
}
});
var txp = w.txProposals.txps[ntxid];
var tx = txp.builder.build();
console.log(tx.isComplete());
var scriptSig = tx.ins[0].getScript();
console.log(scriptSig.toHumanReadable());
console.log(scriptSig.serialize().length);
var size = scriptSig.serialize().length;
console.log('\t scriptSig size: '+size);
if (size > 500) {
if (m === 1) {
end = true;
}
break;
}
}
if (end) break;
}