From d0c43f9bfb41e8ef7a4eb30b17fb17485281bb01 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 1 Aug 2014 11:24:16 -0300 Subject: [PATCH] ALL test passing --- js/models/core/TxProposal.js | 8 +++++--- js/models/core/WalletFactory.js | 8 +++----- test/test.TxProposal.js | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/js/models/core/TxProposal.js b/js/models/core/TxProposal.js index cf2b60f4e..13e04c3b1 100644 --- a/js/models/core/TxProposal.js +++ b/js/models/core/TxProposal.js @@ -159,9 +159,11 @@ TxProposal.prototype._check = function() { if (!tx.ins.length) throw new Error('Invalid tx proposal: no ins'); - var scriptSig = this.builder.vanilla.scriptSig; - if (!scriptSig || !scriptSig.length) { - throw new Error('Invalid tx proposal: no signatures'); + for(var i in tx.ins){ + var scriptSig = tx.ins[i].s; + if (!scriptSig || !scriptSig.length) { + throw new Error('Invalid tx proposal: no signatures'); + } } for (var i = 0; i < tx.ins.length; i++) { diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index 322975221..8858ab2f1 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -102,10 +102,7 @@ WalletFactory.prototype.read = function(walletId) { WalletFactory.prototype.create = function(opts) { opts = opts || {}; - this.log('### CREATING NEW WALLET.' + - (opts.id ? ' USING ID: ' + opts.id : ' NEW ID') + - (opts.privateKey ? ' USING PrivateKey: ' + opts.privateKey.getId() : ' NEW PrivateKey') - ); + this.log('### CREATING NEW WALLET.' + (opts.id ? ' USING ID: ' + opts.id : ' NEW ID') + (opts.privateKey ? ' USING PrivateKey: ' + opts.privateKey.getId() : ' NEW PrivateKey')); opts.privateKey = opts.privateKey || new PrivateKey({ networkName: this.networkName @@ -121,7 +118,8 @@ WalletFactory.prototype.create = function(opts) { }); opts.publicKeyRing.addCopayer( opts.privateKey.deriveBIP45Branch().extendedPublicKeyString(), - opts.nickname); + opts.nickname + ); this.log('\t### PublicKeyRing Initialized'); opts.txProposals = opts.txProposals || new TxProposalsSet({ diff --git a/test/test.TxProposal.js b/test/test.TxProposal.js index fa393c0da..ed0032b20 100644 --- a/test/test.TxProposal.js +++ b/test/test.TxProposal.js @@ -214,10 +214,10 @@ describe('TxProposal', function() { txp.builder.tx.getHashType.restore(); }); it('FAIL no signatures', function() { - var backup = txp.builder.vanilla.scriptSig; - txp.builder.vanilla.scriptSig = []; + var backup = txp.builder.tx.ins[0].s; + txp.builder.tx.ins[0].s = undefined; (function() { txp._check();} ).should.throw('no signatures'); - txp.builder.vanilla.scriptSig = backup; + txp.builder.tx.ins[0].s = backup; }); }); describe('#merge', function() {