commit
3ef5643f60
5 changed files with 18 additions and 8 deletions
1
Makefile
1
Makefile
|
|
@ -18,5 +18,6 @@ android:
|
||||||
cd cordova/project && cordova run android
|
cd cordova/project && cordova run android
|
||||||
|
|
||||||
chrome:
|
chrome:
|
||||||
|
grunt prod
|
||||||
browser-extensions/chrome/build.sh
|
browser-extensions/chrome/build.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,9 @@ PublicKeyRing.prototype.getAddressesOrderer = function(pubkey) {
|
||||||
var l = info.length;
|
var l = info.length;
|
||||||
|
|
||||||
var sortedInfo = _.sortBy(info, function(i) {
|
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;
|
return goodness;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,8 @@ TxProposal.prototype._addSignatureAndVerify = function(signatures) {
|
||||||
|
|
||||||
var inputsFullySigned = 0;
|
var inputsFullySigned = 0;
|
||||||
var newScriptSigs = [];
|
var newScriptSigs = [];
|
||||||
|
|
||||||
|
this.resetCache();
|
||||||
_.each(tx.ins, function(input, index) {
|
_.each(tx.ins, function(input, index) {
|
||||||
var scriptSig = new Script(input.s);
|
var scriptSig = new Script(input.s);
|
||||||
|
|
||||||
|
|
@ -288,11 +290,9 @@ TxProposal.prototype._addSignatureAndVerify = function(signatures) {
|
||||||
input.s = newScriptSigs[index];
|
input.s = newScriptSigs[index];
|
||||||
|
|
||||||
// just to keep TransactionBuilder updated
|
// just to keep TransactionBuilder updated
|
||||||
if (tx.ins.length == inputsFullySigned)
|
if (tx.ins.length == inputsFullySigned)
|
||||||
self.builder.inputsSigned++;
|
self.builder.inputsSigned++;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resetCache();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TxProposal.prototype.resetCache = function() {
|
TxProposal.prototype.resetCache = function() {
|
||||||
|
|
|
||||||
|
|
@ -412,8 +412,12 @@ Wallet.prototype._checkIfTxIsSent = function(ntxid, cb) {
|
||||||
var tx = txp.builder.build();
|
var tx = txp.builder.build();
|
||||||
var txHex = tx.serialize().toString('hex');
|
var txHex = tx.serialize().toString('hex');
|
||||||
|
|
||||||
|
|
||||||
//Use calcHash NOT getHash which could be cached.
|
//Use calcHash NOT getHash which could be cached.
|
||||||
var txid = bitcore.util.formatHashFull(tx.calcHash());
|
var txid = bitcore.util.formatHashFull(tx.calcHash());
|
||||||
|
|
||||||
|
log.debug('Checking if transactions was broadcasted... ID:' + txid);
|
||||||
|
|
||||||
this.blockchain.getTransaction(txid, function(err, tx) {
|
this.blockchain.getTransaction(txid, function(err, tx) {
|
||||||
return cb(err, !err ? txid : null);
|
return cb(err, !err ? txid : null);
|
||||||
});
|
});
|
||||||
|
|
@ -1625,9 +1629,7 @@ Wallet.prototype.broadcastToBitcoinNetwork = function(ntxid, cb) {
|
||||||
|
|
||||||
this.blockchain.broadcast(txHex, function(err, txid) {
|
this.blockchain.broadcast(txHex, function(err, txid) {
|
||||||
if (err || !txid) {
|
if (err || !txid) {
|
||||||
|
log.debug('Wallet:' + self.getName() + ' Send failed:' + err );
|
||||||
log.info('Wallet:' + self.getName() + '. Sent failed:' +
|
|
||||||
err + '. Checking if the TX was sent already');
|
|
||||||
|
|
||||||
self._checkIfTxIsSent(ntxid, function(err, txid) {
|
self._checkIfTxIsSent(ntxid, function(err, txid) {
|
||||||
return cb(err, txid);
|
return cb(err, txid);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ describe('TxProposal', function() {
|
||||||
var SIG0 = '304502200708a381dde585ef7fdfaeaeb5da9b451d3e22b01eac8a5e3d03b959e24a7478022100c90e76e423523a54a9e9c43858337ebcef1a539a7fc685c2698dd8648fcf1b9101';
|
var SIG0 = '304502200708a381dde585ef7fdfaeaeb5da9b451d3e22b01eac8a5e3d03b959e24a7478022100c90e76e423523a54a9e9c43858337ebcef1a539a7fc685c2698dd8648fcf1b9101';
|
||||||
var SIG1 = '3044022030a77c9613d6ee010717c1abc494668d877e3fa0ae4c520f65cc3b308754c98c02205219d387bcb291bd44805b9468439e4168b02a6a180cdbcc24d84d71d696c1ae01';
|
var SIG1 = '3044022030a77c9613d6ee010717c1abc494668d877e3fa0ae4c520f65cc3b308754c98c02205219d387bcb291bd44805b9468439e4168b02a6a180cdbcc24d84d71d696c1ae01';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* decoded redeemscript
|
/* decoded redeemscript
|
||||||
*
|
*
|
||||||
"asm" : "3 03197599f6e209cefef07da2fddc6fe47715a70162c531ffff8e611cef23dfb70d 0380a29968851f93af55e581c43d9ef9294577a439a3ca9fc2bc47d1ca2b3e9127 0392dccb2ed470a45984811d6402fdca613c175f8f3e4eb8e2306e8ccd7d0aed03 03a94351fecc4328bb683bf93a1aa67378374904eac5980c7966723a51897c56e3 03e085eb6fa1f20b2722c16161144314070a2c316a9cae2489fd52ce5f63fff6e4 5 OP_CHECKMULTISIG",
|
"asm" : "3 03197599f6e209cefef07da2fddc6fe47715a70162c531ffff8e611cef23dfb70d 0380a29968851f93af55e581c43d9ef9294577a439a3ca9fc2bc47d1ca2b3e9127 0392dccb2ed470a45984811d6402fdca613c175f8f3e4eb8e2306e8ccd7d0aed03 03a94351fecc4328bb683bf93a1aa67378374904eac5980c7966723a51897c56e3 03e085eb6fa1f20b2722c16161144314070a2c316a9cae2489fd52ce5f63fff6e4 5 OP_CHECKMULTISIG",
|
||||||
|
|
@ -41,6 +43,9 @@ describe('TxProposal', function() {
|
||||||
var someKeys = ["03b39d61dc9a504b13ae480049c140dcffa23a6cc9c09d12d6d1f332fee5e18ca5", "022929f515c5cf967474322468c3bd945bb6f281225b2c884b465680ef3052c07e"];
|
var someKeys = ["03b39d61dc9a504b13ae480049c140dcffa23a6cc9c09d12d6d1f332fee5e18ca5", "022929f515c5cf967474322468c3bd945bb6f281225b2c884b465680ef3052c07e"];
|
||||||
|
|
||||||
|
|
||||||
|
// 3-5
|
||||||
|
|
||||||
|
|
||||||
function dummyBuilder(opts) {
|
function dummyBuilder(opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
|
|
@ -340,7 +345,7 @@ describe('TxProposal', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#addSignature', function() {
|
describe('#addSignature', function() {
|
||||||
it('should add signatures maintaing pubkeys order', function() {
|
it('should add signatures maintaing pubkeys order', function() {
|
||||||
var txp = dummyProposal({
|
var txp = dummyProposal({
|
||||||
nsig:1
|
nsig:1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue