diff --git a/Makefile b/Makefile index 82f13cb53..002958925 100644 --- a/Makefile +++ b/Makefile @@ -18,5 +18,6 @@ android: cd cordova/project && cordova run android chrome: + grunt prod browser-extensions/chrome/build.sh diff --git a/js/models/PublicKeyRing.js b/js/models/PublicKeyRing.js index 97364e2b0..91ff83c5d 100644 --- a/js/models/PublicKeyRing.js +++ b/js/models/PublicKeyRing.js @@ -559,7 +559,9 @@ PublicKeyRing.prototype.getAddressesOrderer = function(pubkey) { var l = info.length; var sortedInfo = _.sortBy(info, function(i) { - var goodness = ( (i.copayerIndex !== copayerIndex) ? 2 * l : 0 ) +( i.isChange ? l : 0 ) + l - i.addressIndex; + var goodness = ( (i.copayerIndex !== copayerIndex) ? 2 * l : 0 ) + + ( i.isChange ? l : 0 ) + + l - i.addressIndex; return goodness; }); diff --git a/js/models/TxProposal.js b/js/models/TxProposal.js index 973924454..63d672093 100644 --- a/js/models/TxProposal.js +++ b/js/models/TxProposal.js @@ -235,6 +235,8 @@ TxProposal.prototype._addSignatureAndVerify = function(signatures) { var inputsFullySigned = 0; var newScriptSigs = []; + + this.resetCache(); _.each(tx.ins, function(input, index) { var scriptSig = new Script(input.s); @@ -288,11 +290,9 @@ TxProposal.prototype._addSignatureAndVerify = function(signatures) { input.s = newScriptSigs[index]; // just to keep TransactionBuilder updated - if (tx.ins.length == inputsFullySigned) + if (tx.ins.length == inputsFullySigned) self.builder.inputsSigned++; }); - - this.resetCache(); }; TxProposal.prototype.resetCache = function() { diff --git a/js/models/Wallet.js b/js/models/Wallet.js index e9b073f5d..ea107a671 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -412,8 +412,12 @@ Wallet.prototype._checkIfTxIsSent = function(ntxid, cb) { var tx = txp.builder.build(); var txHex = tx.serialize().toString('hex'); + //Use calcHash NOT getHash which could be cached. var txid = bitcore.util.formatHashFull(tx.calcHash()); + + log.debug('Checking if transactions was broadcasted... ID:' + txid); + this.blockchain.getTransaction(txid, function(err, tx) { return cb(err, !err ? txid : null); }); @@ -1625,9 +1629,7 @@ Wallet.prototype.broadcastToBitcoinNetwork = function(ntxid, cb) { this.blockchain.broadcast(txHex, function(err, txid) { if (err || !txid) { - - log.info('Wallet:' + self.getName() + '. Sent failed:' + - err + '. Checking if the TX was sent already'); + log.debug('Wallet:' + self.getName() + ' Send failed:' + err ); self._checkIfTxIsSent(ntxid, function(err, txid) { return cb(err, txid); diff --git a/test/TxProposal.js b/test/TxProposal.js index e79348375..d39040e26 100644 --- a/test/TxProposal.js +++ b/test/TxProposal.js @@ -24,6 +24,8 @@ describe('TxProposal', function() { var SIG0 = '304502200708a381dde585ef7fdfaeaeb5da9b451d3e22b01eac8a5e3d03b959e24a7478022100c90e76e423523a54a9e9c43858337ebcef1a539a7fc685c2698dd8648fcf1b9101'; var SIG1 = '3044022030a77c9613d6ee010717c1abc494668d877e3fa0ae4c520f65cc3b308754c98c02205219d387bcb291bd44805b9468439e4168b02a6a180cdbcc24d84d71d696c1ae01'; + + /* decoded redeemscript * "asm" : "3 03197599f6e209cefef07da2fddc6fe47715a70162c531ffff8e611cef23dfb70d 0380a29968851f93af55e581c43d9ef9294577a439a3ca9fc2bc47d1ca2b3e9127 0392dccb2ed470a45984811d6402fdca613c175f8f3e4eb8e2306e8ccd7d0aed03 03a94351fecc4328bb683bf93a1aa67378374904eac5980c7966723a51897c56e3 03e085eb6fa1f20b2722c16161144314070a2c316a9cae2489fd52ce5f63fff6e4 5 OP_CHECKMULTISIG", @@ -41,6 +43,9 @@ describe('TxProposal', function() { var someKeys = ["03b39d61dc9a504b13ae480049c140dcffa23a6cc9c09d12d6d1f332fee5e18ca5", "022929f515c5cf967474322468c3bd945bb6f281225b2c884b465680ef3052c07e"]; + // 3-5 + + function dummyBuilder(opts) { opts = opts || {}; @@ -340,7 +345,7 @@ describe('TxProposal', function() { }); }); - describe('#addSignature', function() { + describe('#addSignature', function() { it('should add signatures maintaing pubkeys order', function() { var txp = dummyProposal({ nsig:1