Merge pull request #1612 from isocolsky/fixes

Correctly assign sentTxid when proposal is broadcasted
This commit is contained in:
Matias Alejo Garcia 2014-10-30 17:39:40 -03:00
commit 6edaf9f1a4
3 changed files with 7 additions and 5 deletions

View File

@ -72,6 +72,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
}
$scope.getShortNetworkName = function() {
var w = $rootScope.wallet;
return w.getNetworkName().substring(0, 4);
};
$scope.amountAlternative = function(amount, txIndex, cb) {

View File

@ -428,7 +428,7 @@ Wallet.prototype._checkSentTx = function(ntxid, cb) {
this.blockchain.getTransaction(txid, function(err, tx) {
if (err) return cb(false);
return cb(ret);
return cb(txid);
});
};
@ -463,10 +463,10 @@ Wallet.prototype._onTxProposal = function(senderId, data) {
var tx = m.txp.builder.build();
if (tx.isComplete()) {
this._checkSentTx(m.ntxid, function(ret) {
if (ret) {
this._checkSentTx(m.ntxid, function(txid) {
if (txid) {
if (!m.txp.getSent()) {
m.txp.setSent(m.ntxid);
m.txp.setSent(txid);
self.emitAndKeepAlive('txProposalsUpdated');
}
}

View File

@ -1609,10 +1609,11 @@ describe('Wallet model', function() {
new: false,
hasChanged: true,
});
w._checkSentTx = sinon.stub().yields(true);
w._checkSentTx = sinon.stub().yields('123');
w._onTxProposal('senderID', data);
txp.setSent.calledOnce.should.be.true;
txp.setSent.calledWith('123').should.be.true;
w.sendTxProposal.called.should.be.false;
done();
});