Merge pull request #1612 from isocolsky/fixes
Correctly assign sentTxid when proposal is broadcasted
This commit is contained in:
commit
6edaf9f1a4
3 changed files with 7 additions and 5 deletions
|
|
@ -72,6 +72,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.getShortNetworkName = function() {
|
$scope.getShortNetworkName = function() {
|
||||||
|
var w = $rootScope.wallet;
|
||||||
return w.getNetworkName().substring(0, 4);
|
return w.getNetworkName().substring(0, 4);
|
||||||
};
|
};
|
||||||
$scope.amountAlternative = function(amount, txIndex, cb) {
|
$scope.amountAlternative = function(amount, txIndex, cb) {
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@ Wallet.prototype._checkSentTx = function(ntxid, cb) {
|
||||||
|
|
||||||
this.blockchain.getTransaction(txid, function(err, tx) {
|
this.blockchain.getTransaction(txid, function(err, tx) {
|
||||||
if (err) return cb(false);
|
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();
|
var tx = m.txp.builder.build();
|
||||||
if (tx.isComplete()) {
|
if (tx.isComplete()) {
|
||||||
this._checkSentTx(m.ntxid, function(ret) {
|
this._checkSentTx(m.ntxid, function(txid) {
|
||||||
if (ret) {
|
if (txid) {
|
||||||
if (!m.txp.getSent()) {
|
if (!m.txp.getSent()) {
|
||||||
m.txp.setSent(m.ntxid);
|
m.txp.setSent(txid);
|
||||||
self.emitAndKeepAlive('txProposalsUpdated');
|
self.emitAndKeepAlive('txProposalsUpdated');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1609,10 +1609,11 @@ describe('Wallet model', function() {
|
||||||
new: false,
|
new: false,
|
||||||
hasChanged: true,
|
hasChanged: true,
|
||||||
});
|
});
|
||||||
w._checkSentTx = sinon.stub().yields(true);
|
w._checkSentTx = sinon.stub().yields('123');
|
||||||
|
|
||||||
w._onTxProposal('senderID', data);
|
w._onTxProposal('senderID', data);
|
||||||
txp.setSent.calledOnce.should.be.true;
|
txp.setSent.calledOnce.should.be.true;
|
||||||
|
txp.setSent.calledWith('123').should.be.true;
|
||||||
w.sendTxProposal.called.should.be.false;
|
w.sendTxProposal.called.should.be.false;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue